No products are associated with this question.
Here's an alternate interpretation, if you want 100 locations in a matrix set to some value, such as 1.
% Randomly place a value of 1 at 100 locations. m=10; % Whatever % Make a "canvass" of all zeroes. theArray = zeros(5*m); % Get 100 linear indices randomly located linearIndices = randperm(numel(theArray), 100); % Make those 100 locations have a value of 1: theArray(linearIndices) = 1;
Play games and win prizes!Learn more