Populate Cells of Structure Array with Empty Tables
Afficher commentaires plus anciens
Hello,
I want to have a Structure Array with 1 x C structure array with N x 10 tables.
Since the total number of columns in the Structure Array varies with the imported data, I'm not sure how to accomplish this.
The first thing I did was make a zero-filled N x 10 table, with which I want to use to populate each cell of the Structure Array.
I wanted to do something like this next:
Table = zeros(N,10)
for i=1:C
Struc_Array.a(i) = Table
end
So essentially, this For Loop is used to A. Create the Structure Array to the appropriate size, and B. Fill each cell with the zero Table.
Table = zeros(N,10)
for i=1:C
Struc_Array(i).a = Table
end
Perhaps my main issue is with how Structure Arrays work and their syntax.
Thanks.
Réponses (1)
This might be what you want:
N=3; C=4;
T = array2table(zeros(N,10));
[Struc_Array(1:C).a]=deal(T);
Struc_Array.a
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!