how do i lopping many data in one folder ?
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
I have data per hour in a folder with two different data types. I want to use the data to get one result, but the existing script can only run per hour. I want to run it directly in 1 month.I attach the data script.
can anyone guide me to lopping the data directly within 1 month?
thanks
2 个评论
Image Analyst
2018-5-26
编辑:Image Analyst
2018-5-28
What do you mean by lopping? Lopping means to cut off to make shorter, like cropping. Is that what you mean - to crop your data? Or do you mean looping, like in a "for" or "while" loop? The FAQ shows you that: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Suvany Aprilia
2018-5-26
回答(1 个)
Jan
2018-5-26
Did you read the link provided by Image Analyst already? http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F.
Use sprintf to define the file names. I cannot guess, which pattern is used to create them:
InFile = 'HMW816010100CAL.dat'
nama_file = 'HMW816010100IR1'
OutFile = 'Gondanglegi_01jan_00.txt'
Perhaps:
for k = 1:31
InFile = sprintf('HMW81601%02d00CAL.dat', k)
nama_file = sprintf('HMW81601%02d00IR1', k);
OutFile = sprintf('Gondanglegi_%02djan_00.txt', k)
...
end
The months and years can be adjusted by sprintf also. Maybe a dir helps to get a klist of existing files at first.
5 个评论
Suvany Aprilia
2018-5-28
Stephen23
2018-5-28
Thank for the answer
Jan
2018-5-28
@Suvany Aprilia: Which file can you "run", and what does this exactly mean? Which data are not changed? Please post the relevant part of you modified code and explain exactly, what you want to be fixed.
Image Analyst
2018-5-28
Look in the command window. It will report the file name of "InFile". What do you see? Does it change as k changes? It should.
Suvany Aprilia
2018-5-28
编辑:Suvany Aprilia
2018-5-28
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!