How to load MAt file into 3D matrix
이전 댓글 표시
I want to load 516 Mat files(240x320)into a 3D Matrix A(240,320,516)
The files are called PVCWARM00071,....,PVCWARM0007516
my code so far:
A = zeros(240,320,516)
nummer=0
>> for i= 1:516
nummer = nummer +1
ext = '.MAT'
naam = 'PVCWARM0007'
file= strcat(naam,num2str(nummer),ext)
A(:,:,i) = load(file)
end
i get the error:Conversion to double from struct is not possible. i already tried to make some adjustments with struct2cell and cell2mat without result.
Can someone help?
Thanks
댓글 수: 2
Azzi Abdelmalek
2013년 8월 9일
What is the name of your matrix in you mat file?
Maxim De Roeck
2013년 8월 9일
채택된 답변
추가 답변 (1개)
Azzi Abdelmalek
2013년 8월 9일
편집: Azzi Abdelmalek
2013년 8월 9일
A = zeros(240,320,516)
nummer=0
for i= 1:516
nummer = nummer +1
ext = '.MAT'
naam = 'PVCWARM0007'
file= strcat(naam,num2str(nummer),ext)
variable_name=whos('-file',file);
x=load(file)
A(:,:,i) = x.(variable_name.name)
end
댓글 수: 2
Maxim De Roeck
2013년 8월 9일
편집: Azzi Abdelmalek
2013년 8월 9일
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!