How to find subscripts of each element inside many rectangular regions of a matrix?
Ältere Kommentare anzeigen
rowStart = [2; 4; 7]; % a column, may be of more than thousand element
rowEnd = [3; 4; 9]; % a column, may be of more than thousand element
colStart = [1; 1; 2]; % a column, may be of more than thousand element
colEnd = [3; 1; 3]; % a column, may be of more than thousand element
% for obvious reason size of all above vectors would be same
function [subRow subCol] = elementwisesubscript(rowStart, rowEnd, colStart, colEnd)
%% interesested function
% I tried 'arrayfun', its working but is slow
% I tried for loop, 1.5x faster than arrayfun. But thinking there could be a smart optimized way
% needed a code, that is matlab coder compatible.
end
Thanks a lot for consideration.
Attached image further examplifies.

Antworten (1)
JAI PRAKASH
am 25 Nov. 2018
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!