Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Loop iteration filling an array

조회 수: 1 (최근 30일)
luca
luca 2019년 10월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi, I have a code with the following structure
for i= 1:7
....
GGG= ....
if i==1
NEXTse= GGG
AAA = NEXTse
elseif i>1
NEXTse = GGG
AAA = [SETT,[NEXTse(1,:);SETT(2,end)+cumsum(diff([0,NEXTse(2,:)]))];
end
SETT=AAA;
end
My objective is to create an array SETT that after seven iteration collect all the value of GGG . During the first iteration I form an array AAA that collect GGG and then I insert it in SETT before pass to i=2.
Then at i=2, I attach to the previous SETT the new GGG through
AAA = [SETT,[NEXTse(1,:);SETT(2,end)+cumsum(diff([0,NEXTse(2,:)]))];
at i= 3 I attach again the GGG created in the third iteration to the previous 2.
I don't know why but the program gives me error, May someone told me why this logic is wrong?
  댓글 수: 2
Fabio Freschi
Fabio Freschi 2019년 10월 10일
what is NEXTse?
luca
luca 2019년 10월 10일
I correct it now

답변 (0개)

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by