我正在创建一个每天都在分析数据的matlab应用程序。 数据从一个csv文件使用xlsread读入()Matlab以变量名保存.mat文件
[num, weather, raw]=xlsread('weather.xlsx');
% weather.xlsx is a spreadsheet that holds a list of other files (csv) i
% want to process
for i = 1:length(weather)
fn = [char(weather(i)) '.csv'];
% now read in the weather file, get data from the local weather files
fnOpen = xlsread(fn);
% now process the file to save out the .mat file with the location name
% for example, one file is dallasTX, so I would like that file to be
% saved as dallasTx.mat
% the next is denverCO, and so denverCO.mat, and so on.
% but if I try...
fnSave=[char(weather(i)) '.mat'] ;
save(fnSave, fnOpen) % this doesn't work
% I will be doing quite a bit of processing of the data in another
% application that will open each individual .mat file
end
++++++++++++++ 抱歉不提供全部信息。 我在执行上述操作时遇到的错误是: 使用保存时出错 参数必须包含一个字符串。
和祥汝和Wolfie,save(fnSave,'fnOpen')按照您的建议工作。现在我有一个dallasTX.mat文件,里面的变量名是fnOpen。我现在可以用这个工作。
感谢您的快速响应。