load .mat files in order

조회 수: 5 (최근 30일)
Yuvashree Mani Urmila
Yuvashree Mani Urmila 2014년 6월 13일
편집: Dishant Arora 2014년 6월 13일
I have a set of output files in structure format saved as .mat (output1,output2,output3,..outputn) I am using this code to load it into my workspace.
for fileNr =1:Nrof files
outputFileName = outputFileNames(fileNr);
outputFileName = outputFileName{1};
outputFileName = strcat(outputFolder, filesep, outputFileName);
FileName=(outputFileName);
data1=load(FileName);
end
But matlab loads files. I want it to be in order. what can be done to achieve this.Thanks
  댓글 수: 1
Roger Wohlwend
Roger Wohlwend 2014년 6월 13일
I don't understand. What does Matlab do now? And what do you want Matlab to do?

댓글을 달려면 로그인하십시오.

채택된 답변

Dishant Arora
Dishant Arora 2014년 6월 13일
편집: Dishant Arora 2014년 6월 13일
Check out this sort_nat function from the file exchange. As far as I understood your question, it might be helpful to you. It helps to sort the string containing digits taking into account numerical order too. Or check out the first method here to read files in order How can I process a sequence of files?
I'd prefer the later method. Comment if I misunderstood your question.

추가 답변 (1개)

Adedeji
Adedeji 2014년 6월 13일
In the help documentation there are several synthax for loading a file, you can load by calling the filename and then string in order the file orders you want to load. i.e. load(filename,'file1','file2'...)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by