Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mat = nan(10, 5);
- start_rows = [3,5,1,7,2];
- % How to avoid that loop
- for idx = 1 : numel(start_rows)
- mat(start_rows(idx):end, idx) = 1;
- end
- (1:size(mat,1)).'+ mat >= start_rows;
- (1:size(mat,1)).'+ 0*mat >= start_rows; % option 1
- (1:size(mat,1)).'+ zeros(size(mat)) >= start_rows; % option 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement