필터 지우기
필터 지우기

read a row from a matrix

조회 수: 2 (최근 30일)
baran
baran 2017년 7월 22일
댓글: baran 2017년 7월 23일
hi,
i have matrix :
E=[1,2,5;2,3,5;3,6,5;4,6,3;4,7,6;4,11,7;4,8,11;8,12,11;5,9,6;9,13,6;13,10,6;6,10,11;6,11,7;13,14,10;14,15,10;10,15,11;11,15,12;15,16,12]
i want to write a code with "For" loop that read each rows in each iteration and attribute its element to i, j and m.
for example in first loop the result will be :
i=1 , j=2 , m=5,
in second time :
i= 2, j=3, m=5 and so on.
how should i write this ? can you help me?
thanks a lot
  댓글 수: 2
Guillaume
Guillaume 2017년 7월 22일
편집: Guillaume 2017년 7월 22일
While it is trivial to do, it is also pointless. It's just giving the name i, j, and m to something that already exist. You may just as well use the name of that something (E) and be done with it.
Why are you asking such an odd question? What is your ultimate goal?
baran
baran 2017년 7월 22일
i dont know how to write a loop that each time change i,j and m . i want to write for a bigger matrix , it just a example .

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 7월 22일
for K = 1 : size(E,1)
i = E(K,1);
j = E(K,2);
m = E(K,3);
%now do something with i, j, m
end
  댓글 수: 1
baran
baran 2017년 7월 23일
thanks alot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by