Convert a 2x1 structure to 1x1 structure

조회 수: 7 (최근 30일)
Tadgh Cullen
Tadgh Cullen 2015년 6월 4일
편집: Guillaume 2015년 6월 4일
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
Image Analyst
Image Analyst 2015년 6월 4일
There is no image attached. Did you forget to click the green and brown frame icon to insert it?

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

채택된 답변

Guillaume
Guillaume 2015년 6월 4일
편집: Guillaume 2015년 6월 4일
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)

추가 답변 (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