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

조회 수: 1 (최근 30일)
VIJAY
VIJAY 2018년 8월 12일
답변: Matt J 2018년 8월 12일
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개)

Matt J
Matt J 2018년 8월 12일
a=A(1:2:end,1:2:end),

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 8월 12일
편집: KALYAN ACHARJYA 2018년 8월 12일
A(:,[2 4])=[]; A([2 4],:)=[];
  댓글 수: 3
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일
A(:,2:2:4) = [];
A(2:2:4,:) = [];

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by