Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. x=[5 3 -5 6 9 7 -2 -3 -4;-5 -3 5 6 9 7 -2 -3 4];
  2.  
  3. s=size(x);
  4.  
  5. tic
  6. indeces=find(x>0);
  7. positive=x(indeces);
  8.  
  9. if(s(1) ==1 || s(2)==1)
  10. disp('positives index location');
  11. fprintf(' %d %d\n',[positive;indeces]);
  12. disp('positives element num location');
  13. fprintf(' %d %d\n',[positive;indeces]');
  14. end
  15. toc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement