Save arrays in a structure
29 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abderrahmane DADA
am 15 Mai 2019
Kommentiert: madhan ravi
am 16 Mai 2019
Hi.
I have written an algorithm that computes an array "b" for each ith iteration [i={1,2,3,4}], and I would like to save those arrays in a structure called "A".
How to save those arrays in the structure "A" where its elements are function of "i", i.e, A = {b1, b2,b3, b4} and to get b1 for instance, one would have to type A.b1.
Regards.
2 Kommentare
Akzeptierte Antwort
madhan ravi
am 15 Mai 2019
doc cell2struct
3 Kommentare
madhan ravi
am 16 Mai 2019
Bearbeitet: madhan ravi
am 16 Mai 2019
A=struct; % an example
for k=1:5
A.(sprintf('b%d',k))=rand(5);
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!