Clear Filters
Clear Filters

変数が認識されない件

9 views (last 30 days)
福永
福永 on 26 Feb 2024
Answered: Atsushi Ueno on 26 Feb 2024
ofile='C:~'; %path of data file
syear="20**"; syearb="**
"; %start year (b:Last two digits of the year)
% set DOY
if mod(str2double(syear),4)==0
a=[101:131,201:229,301:331,401:430,501:531,601:630,701:731,801:831,...
901:930,1001:1031,1101:1130,1201:1231]'; % leap year
else
a=[101:131,201:228,301:331,401:430,501:531,601:630,701:731,801:831,...
901:930,1001:1031,1101:1130,1201:1231]'; % non leap year
end
% judge there is data or not
odir=strcat(ofile,'\',syear,'\');
for i=1:365
if isfile(strcat(odir,syearb,num2str(a(i),'%04u'),'.txt'))==2
a23(i,1)=i;
end
end
for i=1:length(a23)
上記のコードを走らせようとすると、i内のループは1~365まで実行されますが、そのあと
関数または変数 'a23' が認識されません。
for i=1:length(a23)
との表示が出ます。どのように書き換えればよいのかわかる方はいますか。

Answers (1)

Atsushi Ueno
Atsushi Ueno on 26 Feb 2024
> 「関数または変数 'a23' が認識されません」との表示が出ます。
isfile関数が2を返す事は無いので、a23が定義される事もありません。
>どのように書き換えればよいのかわかる方はいますか。
【誤】if isfile(strcat(odir,syearb,num2str(a(i),'%04u'),'.txt'))==2
【正】if isfile(strcat(odir,syearb,num2str(a(i),'%04u'),'.txt'))

Categories

Find more on ビッグ データの処理 in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!