필터 지우기
필터 지우기

HOW TO CALCULATE LINE BY LINE

조회 수: 1 (최근 30일)
heir ancestors
heir ancestors 2017년 1월 26일
답변: Jan 2017년 1월 26일
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

답변 (1개)

Jan
Jan 2017년 1월 26일
Perhaps this helps already:
A = rand(3,4);
for iLine = 1:3
disp(A(iLine, :))
end

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by