how to extract data from struct?

조회 수: 187 (최근 30일)
Muhammad
Muhammad 2021년 9월 2일
답변: Walter Roberson 2021년 9월 2일
i have a struct name 'dataset'
i want to extract data from struct in the form of matrix
load dataset.mat
y=dataset.Mert.AOG.bir.TO.jointAngle;
L5S1 has the following data
struct with fields:
L5S1_x: [1×359 double]
L5S1_y: [1×359 double]
L5S1_z: [1×359 double]
L3L4_x: [1×359 double]
L3L4_y: [1×359 double]
L3L4_z: [1×359 double]
T12L1_x: [1×359 double]
T12L1_y: [1×359 double]
T12L1_z: [1×359 double]
T8T9_x: [1×359 double]
T8T9_y: [1×359 double]
T8T9_z: [1×359 double]
C7T1_x: [1×359 double]
C7T1_y: [1×359 double]
C7T1_z: [1×359 double]
C1Head_x: [1×359 double]
C1Head_y: [1×359 double]
C1Head_z: [1×359 double]
RT4Shoulder_x: [1×359 double]
RT4Shoulder_y: [1×359 double]
RT4Shoulder_z: [1×359 double]
RShoulder_x: [1×359 double]
RShoulder_y: [1×359 double]
RShoulder_z: [1×359 double]
RElbow_x: [1×359 double]
RElbow_y: [1×359 double]
RElbow_z: [1×359 double]
RWrist_x: [1×359 double]
RWrist_y: [1×359 double]
RWrist_z: [1×359 double]
LT4Shoulder_x: [1×359 double]
LT4Shoulder_y: [1×359 double]
LT4Shoulder_z: [1×359 double]
LShoulder_x: [1×359 double]
LShoulder_y: [1×359 double]
LShoulder_z: [1×359 double]
LElbow_x: [1×359 double]
LElbow_y: [1×359 double]
LElbow_z: [1×359 double]
LWrist_x: [1×359 double]
LWrist_y: [1×359 double]
LWrist_z: [1×359 double]
RHip_x: [1×359 double]
RHip_y: [1×359 double]
RHip_z: [1×359 double]
RKnee_x: [1×359 double]
RKnee_y: [1×359 double]
RKnee_z: [1×359 double]
RAnkle_x: [1×359 double]
RAnkle_y: [1×359 double]
RAnkle_z: [1×359 double]
RBallFoot_x: [1×359 double]
RBallFoot_y: [1×359 double]
RBallFoot_z: [1×359 double]
LHip_x: [1×359 double]
LHip_y: [1×359 double]
LHip_z: [1×359 double]
LKnee_x: [1×359 double]
LKnee_y: [1×359 double]
LKnee_z: [1×359 double]
LAnkle_x: [1×359 double]
LAnkle_y: [1×359 double]
LAnkle_z: [1×359 double]
LBallFoot_x: [1×359 double]
LBallFoot_y: [1×359 double]
LBallFoot_z: [1×359 double]
I want to extract each array seperatly .can i use for loop here ,if yes then how ?
  댓글 수: 1
Stephen23
Stephen23 2021년 9월 2일
편집: Stephen23 2021년 9월 2일
The data is already easily accessible via the structure: why can't you just use the structure?
Before you decide to force yourself into writing the slow, complex, very inefficient, time-wasting, difficult-to-debug, obfuscated code required to magically create variables like that, you might like to read this:
and also possibly this:
The best solution by far is to refer to the data in the structure, and not inefficiently create lots of variables.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 9월 2일
struct2cell()

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by