how to increase the no. elements in the array structure

1 Ansicht (letzte 30 Tage)
Luca Re
Luca Re am 22 Nov. 2023
Beantwortet: Walter Roberson am 23 Nov. 2023
>> class(Sis)
ans =
'struct'
size(Sis(1).dailyprof)
ans =
6000
i want all Sis.dailyprof with size =7000 with all other element=0
example:
size(Sis(1).dailyprof) = 7000
size(Sis(2).dailyprof) = 7000
size(Sis(3).dailyprof) = 7000

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Nov. 2023
You did not specify the MATLAB release you are using, so I will take advantage of a new function introduced in R2023b:
for K = 1 : numel(Sis);
Sis(K).dailyprof = resize(Sis(K).dailyprof, 7000);
end
If you are using an earlier release, different code would be needed.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by