Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 0 0 0 1 0 0 0 0 0
- 0 1 0 0 0 1 0 0 1 0
- 0 0 1 0 0 0 1 0 0 1
- 0 0 0 1 0 0 0 0 0 0
- 0 0 0 0 0 0 0 1 0 0
- c1=find(A==1)
- 1 0 0 0 1 1 1 1 1 1
- 0 1 0 0 0 1 1 1 1 1
- 0 0 1 0 1 1 1 1 1 1
- 0 0 0 1 0 0 0 0 1 1
- 1 0 1 0 1 0 0 0 0 0
- 1 1 1 0 0 1 0 0 1 1
- 1 1 1 0 0 0 1 0 1 1
- 1 1 1 0 0 0 0 1 0 0
- 1 1 1 1 0 1 1 0 1 0
- 1 1 1 1 0 1 1 0 0 1
- a=1:size(M)
- R1=1;
- for j=1:size(A)
- A1=A(j,:)
- c=find(A1==1) % finding 1's place
- l=length(c)
- a1 = a(a~=j)
- for k=a1(1):a1(end)
- R1=1;
- for i=1:l1
- temp1=R1
- R1=and(M(j,c(i)),M(k,c(i)))%performing AND operations
- R2=and(R1,temp1)
- end
- if (R2==1) % if the condition is satisified by 1
- A(j,k)=1 % place the 1 in the particular coordinate in A matrix
- end
- end
- end
- New_A=A
- 1 0 0 0 1 0 0 0 0 0
- 0 1 0 0 0 1 0 0 1 0
- 0 0 1 0 0 0 1 0 0 1
- 0 0 0 1 0 0 0 0 1 0
- 1 0 0 0 0 0 0 1 0 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement