我正在創建一個每天都在分析數據的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。我現在可以用這個工作。
感謝您的快速響應。