Info

此问题已关闭。 请重新打开它进行编辑或回答。

Why this for does not avance to the second CSV

1 次查看(过去 30 天)
Tony Castillo
Tony Castillo 2020-10-22
关闭: Rik 2020-10-22
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 个评论
Rik
Rik 2020-10-22
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.

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by