how to save looping data ?
显示 更早的评论
how to save looping data, I have data that consists of 6 years, I process using for-end. but I have trouble storing each data in the form of year_2014 to year_2019.
fileList1 = getAllFiles('D:\MATLAB\change\data maximu\*.xls');
[nn, mm] = size(fileList1);
for jj= 1:nn;
jj;
fname=fileList1{jj} ;
FILE_NAME = sprintf('%s%s',fname(1:29),fname(36:end));
[data, txt,all] = xlsread(FILE_NAME);
.
.
.
.
year_2014 = [ ]
dlmwrite('year_2014.txt',year_2014, 'delimiter', '\t', 'precision', 8, '-append')
end
and only one year is saved, thank you for the advice given to my program thank you
回答(1 个)
KALYAN ACHARJYA
2019-8-2
编辑:KALYAN ACHARJYA
2019-8-2
data_file=cell(1,nn);
for jj= 1:nn;
%......
[data, txt,all] = xlsread(FILE_NAME);
%...........^ change this variable name, check @Madhan's comment
data_file{ii}=data
%.....
end
1 个评论
madhan ravi
2019-8-2
Don't use all as a variable name , will hinder the inbuilt function all() .
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!