Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Why this for does not avance to the second CSV

1 Ansicht (letzte 30 Tage)
Tony Castillo
Tony Castillo am 22 Okt. 2020
Geschlossen: Rik am 22 Okt. 2020
Hi all,
I am working with the extraction of a csv column, and removin NaN, and later I try to accumulate in an array because this procedure has to be done for 12 months, but the script do not acumulate the second execution, do you know what is it wrong?
%%%%Leer y extraer datos de una CSV
current_path = pwd;
close all
Irr_=ones(25,1);
for Dailydata_i=1:2
T = readtable('Dailydata_1.csv', 'PreserveVariableNames', true);
%
I=T(:,3);
A=table2array(I); %%%%%a
Irr=A(1:25);
Irr(isnan(Irr))=0;
M=max(Irr);
m=mean(Irr);
size(Irr);
Irr_=[Irr_];
cd(current_path);
end
z=ones(25,2); %%
I2=([Irr_].*z);
  1 Kommentar
Rik
Rik am 22 Okt. 2020
If you would use the smart indentation, you would notice that you've put the cd inside your loop. Luckily it does nothing, as you didn't change the current directory (nor should you: readtable allows you to specify a full or relative path).
Where are you specifying any acumulation? Where did you specify the second file name? You need to tell Matlab what it should do.

Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by