Multiple File Input Processing
显示 更早的评论
Hello, I need to process multiple input files in a loop and need some assistance. Here is my problem
I'm currently tasked to evaluate satellite rainfall data files (format *.grb, contains a rainfall data matrix for each geo-pixel observed by satellite - about 3000x3000). I have thousands of input files been taken for every 30 minutes interval. Here below is some example file names for one of those input files:
MSG2-SEVI-MSGMPEG-0100-0100-20070605003000.000000000Z-999804.grb
MSG2-SEVI-MSGMPEG-0100-0100-20070605010000.000000000Z-999804.grb
MSG2-SEVI-MSGMPEG-0100-0100-20070605013000.000000000Z-999804.grb
Considering first one as an example, the numbers in the middle indicates the date and time: 2007/06/05 - 00:30. And to read these kind of files (*.grb), I have a code called ReadGRIB2.m (.grb files is not directly readable on Matlab)
Rather than trying to make filenames recognized by Matlab, I just typed dir('*.grb') so matlab can read the grb files on same directory. Here is a reduced overview of my code:
Filename = dir('*.grb');
for i=1:length(Filename)
eval(['load' Filename(i).name ' .grb']);
% Decoding of *.grb file
[Data,Info]=readGRIB2(Filename);
% Presentation of Data - Creates output data wrt input filename
msg2projection(Data,Lat,Lon);
end
When I run the code, I get the following error:
??? Error using ==> load
Number of columns on line 2 of ASCII file
...\MSG2-SEVI-MSGMPEG-0100-0100-20070605003000.000000000Z-999804.grb
must be the same as previous lines.
Error in ==> MPE at 21
eval(['load ' Filename(i).name ' .grb']);
What I understand from error: I think Matlab is unable to mount the file into the ReadGRIB2 function because of being unable to recognize it first. I don't have much experience on Matlab and I would be very faithful if you can assist me.
Thanks very much in advance.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!