Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. mat = nan(10, 5);
  2. start_rows = [3,5,1,7,2];
  3.  
  4. % How to avoid that loop
  5. for idx = 1 : numel(start_rows)
  6. mat(start_rows(idx):end, idx) = 1;
  7. end
  8.  
  9. (1:size(mat,1)).'+ mat >= start_rows;
  10.  
  11. (1:size(mat,1)).'+ 0*mat >= start_rows; % option 1
  12. (1:size(mat,1)).'+ zeros(size(mat)) >= start_rows; % option 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement