I have a cell R={Transport.name}; which is 1*20 cell
I want to check my input string( from the user) will exist in R or not? Can anyone please help me? Thanks

 채택된 답변

per isakson
per isakson 2018년 2월 24일
편집: per isakson 2018년 2월 24일

0 개 추천

Try this
%%Sample data
str = char(randi(double(['A','Z']),[20,3] )); % Too smart
cac = mat2cell( str, ones(1,20),3 );
R = cac';
input_string = R{13};
%%Check if input_string exists in R
ismember( input_string, R )
returns
ans =
1

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

태그

질문:

Jab
2018년 2월 24일

편집:

2018년 2월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by