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

Got it. If anybody is interested in the solution:
counter = 1;
f = cell(m1,1);
for ii = 1:m1
f{ii} = zeros(counter, 1);
counter = counter + 1;
end
Slightly simplified the code.
m1 = 1275;
f = cell(m1,1);
for kk = 1:m1
f{kk} = zeros(kk, 1);
end
Jan
Jan 2017년 3월 3일
@Akira: Please post this as answer, such that the it can be accepted to mark this thread as solved.
Akira Agata
Akira Agata 2017년 3월 8일
@Jan: Sorry for my belated response. I've just posted it as answer. Thank you!

댓글을 달려면 로그인하십시오.

 채택된 답변

Akira Agata
Akira Agata 2017년 3월 8일

1 개 추천

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2017년 1월 13일

댓글:

2017년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by