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

error using 256x256matrix

Asked by FIR on 10 Feb 2012
Latest activity Edited by sixwwwwww on 11 Oct 2013
A=[2 4 5 3
 6 8 9 2
5  1 3 4 ];
A_1_10 = A(:,:,ones(10,1));
k = nchoosek(1:9,3);
k2 = k(all(diff(k,1,2)>1,2),:)
k3 = k2(1:floor(size(k2,1)/10):end,:)
A_1_10(bsxfun(@plus,k3(1:10,:),(0:9:9^2).')) = 0
i get answer for this
nut for 256x256 i am not getting the answer in which some values must be replaced by zero

0 Comments

FIR

Tags

Products

No products are associated with this question.

1 Answer

Answer by Andrei Bobrov on 14 Feb 2012
A=[2 4 5 3
 6 8 9 2
5  1 3 4 ];
n = numel(A);
m = 10;
t = 4;
A_1_10 = A(:,:,ones(m,1));
k = nchoosek(1:n,t);
k2 = k(all(diff(k,1,2)>1,2),:)
k3 = k2(1:floor(size(k2,1)/m):end,:)
A_1_10(bsxfun(@plus,k3(1:m,:),(0:n:n*(m-1)).')) = 0

3 Comments

FIR on 14 Feb 2012

Yes andrei,but one thing is that ,i get only 4 zeros,if i take 256x256 matrix i need atleast 60-70 zeros,please help

Andrei Bobrov on 14 Feb 2012

t = 60;

FIR on 14 Feb 2012

Andrei my system returns out of memory wen i give t=60,

Andrei Bobrov

Contact us