Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 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. disp('positive numbers location')
  5. tic
  6. for i=1:s(1)
  7. for j=1:s(2)
  8. if x(i,j)>0
  9. positive =x(i,j);
  10.  
  11. fprintf(' %d (%d,%d)\n',[positive i j]');
  12. end
  13. end
  14. end
  15. disp('')
  16. toc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement