for loop question

4 次查看(过去 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