I am trying to save each data point in a table t while looping, but I always get the last data point which is 2012!
=

답변 (1개)

Mario Malic
Mario Malic 2020년 11월 23일

0 개 추천

Because your t accepts only a scalar and it gets overwritten every single time.
% Before loop
n = 1;
t = zeros(1,length(1977:2012));
for i
t(n) = monthYear...
n = n + 1;
end

댓글 수: 2

zakary Surprenant
zakary Surprenant 2020년 11월 23일
Hey,
Whe i try to run this code;it gives me this error
I tried using table2array but it still did not work, any idea
Mario Malic
Mario Malic 2020년 11월 23일
I haven't worked with timetable before. Probably, you need to initialise t as a timetable, and use dot indexing to change its values.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2020년 11월 22일

댓글:

2020년 11월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by