how do i lopping many data in one folder ?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
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 Comments
Image Analyst
on 26 May 2018
Edited: Image Analyst
on 28 May 2018
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
on 26 May 2018
Answers (1)
Jan
on 26 May 2018
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 Comments
Suvany Aprilia
on 28 May 2018
Stephen23
on 28 May 2018
Thank for the answer
Jan
on 28 May 2018
@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
on 28 May 2018
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
on 28 May 2018
Edited: Suvany Aprilia
on 28 May 2018
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!