what is the meaning of these two lines?

1 次查看(过去 30 天)
siz = size(P);
for i = 1:siz(2)
with P is a 2*k matrix, P =[p1 .....pk] I want to understand what siz(2) means in the for loop. Thanks!!

采纳的回答

Geoff Hayes
Geoff Hayes 2017-11-30
Saf - the size function returns the dimensions of the input parameter. In your case, if P is a 2x12 matrix so size(P) is
siz = size(P);
siz =
[ 2 12 ]
The for loop then iterates from 1 to siz(2) which (in this case) will be 12. So the loop will iterate over the number of columns in P.

更多回答(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