MATLAB Answers

VIJAY
0

how to delete row and column at a single command????????????

Asked by VIJAY
on 12 Aug 2018
Latest activity Answered by Matt J
on 12 Aug 2018
A=[1 2 3 4 5; 6 7 8 9 10; 11 12 13 14 15; 16 17 18 19 20;];
I want to delete 2row and 2 column,4 row and 4 column
my require output is
a=[1 3 5; 11 13 15]

  1 Comment

I have edited the answer, pls check and confirm?

Sign in to comment.

3 Answers

Answer by Matt J
on 12 Aug 2018

a=A(1:2:end,1:2:end),

  0 Comments

Sign in to comment.


Answer by KALYAN ACHARJYA on 12 Aug 2018
Edited by KALYAN ACHARJYA on 12 Aug 2018

A(:,[2 4])=[]; A([2 4],:)=[];

  3 Comments

regard your answer A=[1 3 4 5; 11 13 14 15; 16 18 19 20;]
Now size of array is 3*3 then how can i delete 4 row and 4 column ???????
A(:,[2 4])=[] %to delete 2 and 4 col simultenously
Answer here
A(:,[2 4])=[]; A([2 4],:)=[];

Sign in to comment.


Answer by Paolo
on 12 Aug 2018

A(:,2:2:4) = [];
A(2:2:4,:) = [];

  0 Comments

Sign in to comment.