the for loop is only giving me the last value

3 ビュー (過去 30 日間)
Othman Alkandri
Othman Alkandri 2022 年 1 月 19 日
コメント済み: Star Strider 2022 年 1 月 19 日
Hello guys, the for loop only gives me the last value of the .csv file. Some people have the same issue as mine seam. Most posts recommend adding a zero vector. I added the zero vector, but the problem is still remaining.
Data_table = readtable('20170401damlbmp_zone.csv')
Data_20170401 = readmatrix('20170401damlbmp_zone.csv')
% take the N.Y.K and North inromation from the loaded files
North_20170401 = zeros(360,6);
N_Y_K_20170401 = zeros(360,6);
for i = 10 :15 : 360
%for j = 1:1:24
disp( Data_20170401(i,3))
N_Y_K_20170401(i,1)= Data_20170401(i,3);
x= i+1;
North_20170401(i,1) = Data_20170401(x,3);
% end
  1 件のコメント
the cyclist
the cyclist 2022 年 1 月 19 日
Can you upload the data, using the paperclip icon in the INSERT section of the toolbar?



Star Strider
Star Strider 2022 年 1 月 19 日
There are likely a lot of zeros in the vectors because of the way ‘i’ is defined.
The loop is likely not necessary anyway.
Try something like this —
i = 10 : 15 : 360;
N_Y_K_20170401 = Data_20170401(i,3);
North_20170401 = Data_20170401(i+1,3);
  7 件のコメント
Star Strider
Star Strider 2022 年 1 月 19 日
As always, my pleasure!


その他の回答 (0 件)



Community Treasure Hunt

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

Start Hunting!

Translated by