필터 지우기
필터 지우기

Move select data out of a structure

조회 수: 2 (최근 30일)
Richard Youden
Richard Youden 2019년 1월 18일
댓글: Richard Youden 2019년 1월 21일
I have a large structure made up of 45 fields. Each field contains nearly 700,000 double values.
What I'd like to do is create another structure, duplicate the fields and move a predetermined number of data values.
I'd end up with structure A containing 45 fields with 600,000 doubles values and structure B containing the same 45 fields and the first 100,000 double values from the first structure. Hopefully you follow this!
Any idea?
Thanks in advance.

답변 (2개)

Walter Roberson
Walter Roberson 2019년 1월 18일
[A,B] = structfun( @(FF) deal(FF(100000+1:end), FF(1:100000)), YourStructure, 'Uniform', 0)
  댓글 수: 1
Richard Youden
Richard Youden 2019년 1월 21일
This worked perfectly, thanks!

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


StefBu
StefBu 2019년 1월 18일
How are your double values organized inside the structure fields? In cells,etc....?

카테고리

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