Clear Filters
Clear Filters

how to extract data from struct?

190 views (last 30 days)
i have a struct name 'dataset'
i want to extract data from struct in the form of matrix
load dataset.mat
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 Comment
Stephen23 on 2 Sep 2021
Edited: Stephen23 on 2 Sep 2021
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.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Sep 2021

More Answers (0)


Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!