【发布时间】:2019-07-17 13:11:54
【问题描述】:
我正在尝试保存具有特定文件名的 2 列矩阵,但我不断生成相同的错误消息:
Error using save
Must be a string scalar or character vector
我的代码如下所示:
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);
我还尝试通过首先将 TheData 设为空矩阵来将“TheData”变量设为双向量,因此代码看起来像这样,带有额外的一行:
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);
我只想用特定于标本的名称保存这个矩阵,我不知道为什么我正在做的事情不起作用。请帮忙!
谢谢
【问题讨论】: