Load file with certain number
이전 댓글 표시
Dear all,
I'm writing a program in Matlab, where all data is first loaded from the file '20.mat'. Then I create a vector with all 20's, to remember the data in that column is from the film '20.mat'. After some scripts, I want to replace one of these column with data from a file-number lower. So for example:
First: A=[20 20 20 20 20]
Replacing place: 4
Load data with number from A(4)-1 = 19, and replace column 4 with the data from column 4 of '19.mat'.
The problem however is that I don't know beforehand with number I have to load, because if in the next step the replacing place is 1, I again need to load data from '19.mat', but if I again have to replace place 4, I have to load '18.mat'. I could write an if-loop for all separate cases, but because there are quite a lot of cases, I was wondering if there is a direct way to do this. Something like load('r.mat'), where r=A(4)-1.
Kind regards, Marjolein
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!