Azzera filtri
Azzera filtri

copy a first block of structure to an array

2 visualizzazioni (ultimi 30 giorni)
Jatin Arora
Jatin Arora il 4 Dic 2012
I am a beginner to MATLAB so bear with me.
I have a 1*n structure, and in each of the structure element I have m*3 elements. I want to store the first structure element to a new array. Kindly help me with this problem.
Thanks

Risposte (1)

Javier
Javier il 4 Dic 2012
Modificato: Javier il 4 Dic 2012
Hello Jatin
Im going to create a structure to try to understand you better.
data={'A','B','C'}
struc1.(data{1})=randn(10,1)
struc1.(data{2})=randn(10,1)
struc1.(data{3})=randn(10,1)
Now Struc1 is an structure and has 3 elements. If want to store the struck1.A data to a new array, just define the array and make it equal to the element of the structure. For example.
HH=zeros(10,3)
HH(:,1)=struc1.A
Hope this help. Best regards and welcome to Matlab community

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by