Convert a 2x1 structure to 1x1 structure

5 vues (au cours des 30 derniers jours)
Tadgh Cullen
Tadgh Cullen le 4 Juin 2015
Modifié(e) : Guillaume le 4 Juin 2015
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 commentaire
Image Analyst
Image Analyst le 4 Juin 2015
There is no image attached. Did you forget to click the green and brown frame icon to insert it?

Connectez-vous pour commenter.

Réponse acceptée

Guillaume
Guillaume le 4 Juin 2015
Modifié(e) : Guillaume le 4 Juin 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)

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by