how to use this script with multiple data

hi hi I'm just learning matlab. I have a script to process the satellite data are only for 1 hour. I had to do the data every hour for 2 months. please help me to edit this script. The formula by subtracting the data at the same hour.
nx=141;ny=81;
dlon=0.05;dlat=0.05;
lat=-8:dlat:-4;
lon=103:dlon:110;
%load data tbb
fid1=fopen('IR1_10101501.dat','r');
fid2=fopen('IR2_10101501.dat','r');
tbb1=fread(fid1,[nx,ny],'float32');
tbb2=fread(fid2,[nx,ny],'float32');
tbb12=tbb1-tbb2;
for j=1:ny-1
for i=1:nx-1
tbb12=tbb1-tbb2;
end
end
fclose(fid1);
fclose(fid2);

3 件のコメント

Walter Roberson
Walter Roberson 2011 年 12 月 27 日
http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Jan
Jan 2011 年 12 月 27 日
To make a helpful answer much easier, delete all lines, which do not concern the problem in the posted code. Currently it is hard to see, what you want to modify.
Walter Roberson
Walter Roberson 2011 年 12 月 29 日
Note: your lines
tbb12=tbb1-tbb2;
for j=1:ny-1
for i=1:nx-1
tbb12=tbb1-tbb2;
end
end
have the nested for loops repeating over and over again the tbb12=tbb1-tbb2 that was already done outside the loop. At this time those nested for loops appear to be redundant.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2011 年 12 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by