Azzera filtri
Azzera filtri

the for loop is only giving me the last value

20 visualizzazioni (ultimi 30 giorni)
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
end
  1 Commento
the cyclist
the cyclist il 19 Gen 2022
Can you upload the data, using the paperclip icon in the INSERT section of the toolbar?

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 19 Gen 2022
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 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by