Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. 1 0 0 0 1 0 0 0 0 0
  2. 0 1 0 0 0 1 0 0 1 0
  3. 0 0 1 0 0 0 1 0 0 1
  4. 0 0 0 1 0 0 0 0 0 0
  5. 0 0 0 0 0 0 0 1 0 0
  6.  
  7. c1=find(A==1)
  8.  
  9. 1 0 0 0 1 1 1 1 1 1
  10. 0 1 0 0 0 1 1 1 1 1
  11. 0 0 1 0 1 1 1 1 1 1
  12. 0 0 0 1 0 0 0 0 1 1
  13. 1 0 1 0 1 0 0 0 0 0
  14. 1 1 1 0 0 1 0 0 1 1
  15. 1 1 1 0 0 0 1 0 1 1
  16. 1 1 1 0 0 0 0 1 0 0
  17. 1 1 1 1 0 1 1 0 1 0
  18. 1 1 1 1 0 1 1 0 0 1
  19.  
  20. a=1:size(M)
  21. R1=1;
  22. for j=1:size(A)
  23. A1=A(j,:)
  24. c=find(A1==1) % finding 1's place
  25. l=length(c)
  26. a1 = a(a~=j)
  27. for k=a1(1):a1(end)
  28. R1=1;
  29. for i=1:l1
  30. temp1=R1
  31. R1=and(M(j,c(i)),M(k,c(i)))%performing AND operations
  32. R2=and(R1,temp1)
  33. end
  34. if (R2==1) % if the condition is satisified by 1
  35. A(j,k)=1 % place the 1 in the particular coordinate in A matrix
  36. end
  37. end
  38. end
  39. New_A=A
  40.  
  41. 1 0 0 0 1 0 0 0 0 0
  42. 0 1 0 0 0 1 0 0 1 0
  43. 0 0 1 0 0 0 1 0 0 1
  44. 0 0 0 1 0 0 0 0 1 0
  45. 1 0 0 0 0 0 0 1 0 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement