HOW TO CALCULATE LINE BY LINE
1 回表示 (過去 30 日間)
古いコメントを表示
Hello Every one ; I have a matrix A of a 6*7 elements
A11 A21 A31 A41 ...
A12 A22 A32 A42 ...
A13 A23 A33 A43 ...
. . . . ...
if I want to make a for loop but I want to calculate line by line : I mean : I want to calculate : A11, A12, A13...after go to the second column calculate : A21,A22,A23, after go to third column calculate : A31,A32,A33 ....
If I put the loop
[s z]=size(A)
for i=1:s-1
for j=1:z
for y=2:s
B(i,j)=A(i,j)+cosd (A(y,j))
end
end
end
How can I calculate line by line ? Calculates first line of elements, then second line of elements then third ...as explained before ?
Thank you in advance
0 件のコメント
回答 (1 件)
Jan
2017 年 1 月 26 日
Perhaps this helps already:
A = rand(3,4);
for iLine = 1:3
disp(A(iLine, :))
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!