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