performing without randperm function

1 次查看(过去 30 天)
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

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-2-14
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by