Iteration in array of three columns and ten rows
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!