help with preallocating arrays?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i need help making making this preallocated array
myArray = []
variableArray = []
for i=1:10
variable = [1,2,3]
variableArray = [variable]
myArray = [myArray; variableArray]
end
0 Kommentare
Antworten (1)
Roger Stafford
am 10 Apr. 2015
myArray = zeros(1,10);
for k = 1:10
myArray(k) = k+1;
end
or better still:
myArray = 2:11;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices 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!