Advertisement
Guest User

Untitled

a guest
Feb 5th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. row=30;
  2. c=1:10;
  3.  
  4. E= fix(rand(row,length(c))*100);
  5.  
  6.  
  7. for i=1:length(c) //i used this loop to do an example..
  8. in(i)=fix(abs(rand(1)*10));
  9. if !in(i)
  10. in(i)=1;
  11. endif
  12. endfor
  13.  
  14. I want to SPEED it the loop (for hh=1:length(in) , for gg=in(hh):row )
  15. for hh=1:length(in)
  16. maxRel=-999999999999999999;
  17. minRel=9999999999999999999;
  18. rangeRel=0;
  19. for gg=in(hh):row
  20. v1=E(gg,hh)>maxRel;
  21. maxRel=max(E(gg,hh),maxRel);
  22. minRel=!v1*minRel+v1*9999999999999999999999;
  23.  
  24. minRel=min(E(gg,hh),minRel);
  25. diff=maxRel-minRel;
  26. rangeRel=max(diff,rangeRel);
  27. endfor
  28. Range(hh)=rangeRel;
  29. endfor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement