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

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 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 12 日
I have edited the answer, pls check and confirm?

サインインしてコメントする。

回答 (3 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 12 日
編集済み: KALYAN ACHARJYA 2018 年 8 月 12 日

0 投票

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

3 件のコメント

VIJAY
VIJAY 2018 年 8 月 12 日
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 ???????
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 12 日
A(:,[2 4])=[] %to delete 2 and 4 col simultenously
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 8 月 12 日
Answer here
A(:,[2 4])=[]; A([2 4],:)=[];

サインインしてコメントする。

Paolo
Paolo 2018 年 8 月 12 日

0 投票

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

質問済み:

2018 年 8 月 12 日

回答済み:

2018 年 8 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by