Creating zero value vectors with for-loop

6 Ansichten (letzte 30 Tage)
Christian Plitz
Christian Plitz am 13 Jan. 2017
Kommentiert: Akira Agata am 8 Mär. 2017
Hi there,
I want to create m1 vectors which increase their size step by step. All values of the vectors should be 0. So the first vector has the size 1x1 the second 2x1 and so on. I tried it using a for loop but I ended up with an array exceeds maximum error...
m1 = 1275;
for m = 1:m1
f(m) = zeros(1:m1);
end
  4 Kommentare
Jan
Jan am 3 Mär. 2017
@Akira: Please post this as answer, such that the it can be accepted to mark this thread as solved.
Akira Agata
Akira Agata am 8 Mär. 2017
@Jan: Sorry for my belated response. I've just posted it as answer. Thank you!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Akira Agata
Akira Agata am 8 Mär. 2017
I would like to re-post it. Thank you, Jan-san!
m1 = 1275;
f = cell(m1,1);
for kk = 1:m1
f{kk} = zeros(kk, 1);
end

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by