Move select data out of a structure

1 vue (au cours des 30 derniers jours)
Richard Youden
Richard Youden le 18 Jan 2019
Commenté : Richard Youden le 21 Jan 2019
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.

Réponses (2)

Walter Roberson
Walter Roberson le 18 Jan 2019
[A,B] = structfun( @(FF) deal(FF(100000+1:end), FF(1:100000)), YourStructure, 'Uniform', 0)
  1 commentaire
Richard Youden
Richard Youden le 21 Jan 2019
This worked perfectly, thanks!

Connectez-vous pour commenter.


StefBu
StefBu le 18 Jan 2019
How are your double values organized inside the structure fields? In cells,etc....?

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by