Iteration in array of three columns and ten rows
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all, i have one question. I want to iterate in array follow the next steps:
i) First i analize one column and one row. The name of array with data is DNA and the name of outcome is "serial".
if true
% code
t=3 ;number of columns in array DNA
n= length(DNA)
for i=1:n
if DNA(i,1)==1 % if first column and "i" row is one, then the outcome row array is one
serial(i)=1;
elseif DNA(i,1)==-1 % if first column and "i" row is -1, then the outcome row array is -1
serial(i)=-1;
elseif DNA(i,1)==0 % Here i start to having doubts. If i have zero, i want analize the same row in % %column two
for j=2:t;
if DNA(i,j)==1 % i analize the same row and column two
serial(i)=1;
elseif DNA(i,j)==-1
serial(i)=-1;
elseif DNA(i,j)==0 % if i have zero in same row in column two, i want to analize the same %row in column three and look like my code is wrong...
end
I put the example with "i" arrows and three columns but my data is generic:
i=1,2,3,4.......n % rows j=1,2,3,4.......t % columns
How can i code this?
Thank you very much
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!