Convert a 2x1 structure to 1x1 structure

I received a large data set that I'm trying to work with as part of my dissertation but its in a 2x1 structure (see attached image). Is it possible to convert this to a 1x1 structure or to split them into two 1x1 structures. If not any ideas how I would work with it? How would I change the below code to read in the first structure?
XComp=data.XComp;
YComp=data.YComp;

1 Comment

There is no image attached. Did you forget to click the green and brown frame icon to insert it?

Sign in to comment.

 Accepted Answer

Guillaume
Guillaume on 4 Jun 2015
Edited: Guillaume on 4 Jun 2015
structures arrays work the same as normal arrays. Just use indexing to access individual elements:
s = struct('f1', {5; 6}, 'f2', {'aaa'; 'bbb'}) %demo data, create a 2x1 struct array
s1 = s(1)
s2 = s(2)

More Answers (0)

Categories

Asked:

on 4 Jun 2015

Edited:

on 4 Jun 2015

Community Treasure Hunt

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

Start Hunting!