Batch processing using loops
이전 댓글 표시
I'm trying to analyze multiple .mat files that only differ in the name of each file. I essentially want to run each file under the same code, but I don't want to laboriously change the name of the loaded file. Is there syntax that I could put in the front and end of my code so I can loop the script to run for all the files in a given directory. The .mat files only differ by a sequence of numbers within the name, so could I input some sort of string beforehand, so all matlab has to do is open files based on a prewritten string. I don't know if that made sense, I'm new to this program....Thanks for your patience.
This is an example of what I'm trying to do: The data vector are the numbers that vary from file to file. All I want to do is take these numbers, put them into a file name and load that file. Is this possible?
data = [110535, 112212, 113327, 114252, 115310, 120216, 121047, 121837, 123235, 124703, 125857, 131222,132322, 133328, 134052, 135138, 140132, 141120, 142016, 143316, 144304, 145623];
for k = data(1,i) kalmanized_data = sprintf('DATA20140218_%d.kalmanized.h5-short-only.mat', k); load (kalmanized_data); CODE end
Any help is appreciated!
Thank you!
채택된 답변
추가 답변 (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!