Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

performing without randperm function

Asked by FIR

FIR

on 14 Feb 2012
Accepted Answer by Andrei Bobrov

Andrei Bobrov

from code below i get 10 matrix values,using randperm function,please can anyone tell how to perform without using randperm,

A=imread('dock.jpg');
A=rgb2gray(A);
A=imresize(A,[256 256])
A=double(A)
n = numel(A);
A1_10 = repmat(A,[1,1,10]);
t = ones(size(A));
for j1 = 1:size(A1_10,3)
    p = t;
    k = randperm(n);
   k1=[1:n];
    p(k(1:6000)) = 0;
    A1_10(:,:,j1) = A1_10(:,:,j1).*p;
end
A1_10

1 Comment

FIR

FIR

on 14 Feb 2012

Walter may i know what u have edited

FIR

FIR

Tags

Products

No products are associated with this question.

1 Answer

Answer by Andrei Bobrov

Andrei Bobrov

on 14 Feb 2012
Accepted answer
A=imread('dock.jpg');
A=rgb2gray(A);
A=imresize(A,[256 256])
A=double(A)
n = numel(A);
A1_10 = repmat(A,[1,1,10]);
t = ones(size(A));
for j1 = 1:size(A1_10,3)
    p = t;
    p(randi(n,6000,1)) = 0;
    A1_10(:,:,j1) = A1_10(:,:,j1).*p;
end
A1_10

1 Comment

FIR

FIR

on 14 Feb 2012

Thanks andrei

Andrei Bobrov

Andrei Bobrov

Contact us