for loop question

조회 수: 3 (최근 30일)
raymond
raymond 2011년 11월 28일
hello i'm trying tom make my for loop iterate 100,1000,10000 and 100000 times using this code
n=[1 2 3 4]
for i=1:1:100.^n
r= i
end
for some reason it only iterates once can someone tell me why please and help me fix it

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 11월 28일
n = 1:4;
r = cell2mat(arrayfun(@(x)1:10*10^x,n,'un',0));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by