Let's say we have matrix A=[1 2 3; 4 5 6; 7 8 9; 10 11 12], and b a number the user is inserting.
I want to delete 1st row if b=1, or delete the 2nd row if b=2 etc. Is this possible?

 채택된 답변

madhan ravi
madhan ravi 2019년 5월 9일
편집: madhan ravi 2019년 5월 9일

2 개 추천

A=[ 1 2 3;...
4 5 6;...
7 8 9;...
10 11 12]
b=2;
A(b,:)=[]

추가 답변 (1개)

KSSV
KSSV 2019년 5월 9일

1 개 추천

b = 1 ;
A(b,:) = [] ;

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2019년 5월 9일

편집:

2019년 5월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by