I'm trying to save a 2 column matrix with a specific file name but I keep generating the same error message:
Error using save
Must be a string scalar or character vector
My code looks like this:
CustomName = ['TheDataFrom','_', animalname, '-', animalnumber,'-',num2str(stimNumber), num2str(stimType), '.mat']); % the name I want the file to have, changes with different specimens
TheData(:,1) = codes(index,1);
TheData(:,2) = times(values,1)); %both of these vectors are the same length
save(CustomName, TheData);
I have also tried making 'TheData' variable into a double vector by making TheData an empty matrix first, so the code looks like this with the extra line:
CustomName = ['TheDataFrom','_', animalname, '-', animalnumber,'-',num2str(stimNumber), num2str(stimType), '.mat']); % the name I want the file to have, changes with different specimens
TheData = zeros(length(index), 2) %make a matrix of the right number of rows and columns, comes out as class 'double'
TheData(:,1) = codes(index,1); %put data into each column
TheData(:,2) = times(values,1));
save(CustomName, TheData);
I just want to save this matrix with a specimen specific name, I am out of ideas for why what I'm doing is not working. Please help!
Thank you