필터 지우기
필터 지우기

Keep Only Cells With a String Beginning with a Certain Letter

조회 수: 13 (최근 30일)
Calum
Calum 2014년 10월 24일
편집: Adam 2014년 10월 24일
If I have a data-set as follows:
['ABC'; 'ABC'; 'ABC'; 'DEF'; 'DEF'; 'DEF'; 'XYZ'; 'XYZ'; 'XYZ']
How do I only keep rows which contain a string beginning with the letter 'D'?
Regards,
CS

답변 (1개)

Adam
Adam 2014년 10월 24일
편집: Adam 2014년 10월 24일
s = ['ABC'; 'ABC'; 'ABC'; 'DEF'; 'DEF'; 'DEF'; 'XYZ'; 'XYZ'; 'XYZ'];
s = s( s(:,1) == 'D',: );
assuming you stated the full complexity of the problem in your question.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by