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

 Akzeptierte Antwort

per isakson
per isakson am 24 Feb. 2018
Bearbeitet: per isakson am 24 Feb. 2018

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Produkte

Tags

Gefragt:

Jab
am 24 Feb. 2018

Bearbeitet:

am 24 Feb. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by