how to save looping data ?
Show older comments
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
Answers (1)
KALYAN ACHARJYA
on 2 Aug 2019
Edited: KALYAN ACHARJYA
on 2 Aug 2019
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 Comment
madhan ravi
on 2 Aug 2019
Don't use all as a variable name , will hinder the inbuilt function all() .
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!