How to store the co-ordinates of a pixel in an array?
1 view (last 30 days)
AJ von Alt on 21 Jan 2014
Assuming that by the first 10 pixels, you mean the first 10 in column major order, find will do this for you.
% Generate a random logical matrix
binMat = binornd(1,0.5,[20 20]);
numToFind = 10; % number of indices to find
% find the subscript indcies for the first numToFind values set to 1 in
% column major order
[r , c] = find( binMat , numToFind );