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
KALYAN ACHARJYA 2019년 8월 2일
편집: KALYAN ACHARJYA 2019년 8월 2일

0 개 추천

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
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에 대해 자세히 알아보기

질문:

2019년 8월 2일

편집:

2019년 8월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by