Matlab programming the sequence talked about here is a matri

Matlab programming; the \"sequence\" talked about here is a matrix sequence, so searching a matrix from right to left for example. Thank you.

Solution

%let defien matrix A and search the sequence 5,4,3 right to left
A=[1,2,3,4,5,6;2,3,4,5,6,1;3,4,5,6,1,2;4,5,6,1,2,3;5,6,1,2,3,4;6,1,2,3,4,5]
l=length(A);
a=1,;b=1
for i=l:l-1:1
for j=l:l-1:1
if(A(i,j)==5)
if(A(i,j-1)==4)
if(A(i,j-2)==3)
m(a)=i;
n(b)=j;
a=a+1;
b=b+1;
end;
end;
end
end
end
  

Matlab programming; the \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site