How to extract a column from a structure and save as a 4D matrix

조회 수: 4 (최근 30일)
Sriparna Sen
Sriparna Sen 2020년 1월 14일
답변: Jyotsna Talluri 2020년 1월 17일
If I have a structure with 56 rows and 3 columns, and I want to extract all information in the 3rd column with the field name 'VMPData', and save it as a 4-D matrix how do I do that via code? Each row in the 3rd column contains 3D information, but I want to save the full column as a 4D matrix.
Thank you so much in advance!!

답변 (1개)

Jyotsna Talluri
Jyotsna Talluri 2020년 1월 17일
4D matrix is obtained by concatening 3D matrices using cat function
Suppose your structure array is S which has 3D information in field 'VMPData'
mat=S(1).VMPData;
for i=1:numel(S)-1
mat=cat(4,mat,S(i+1).VMPData);
end
Refer to the below link

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by