MATLAB Answers

Comparing any of the matrix input

1 view (last 30 days)
betul uslu
betul uslu on 18 Dec 2019
Commented: betul uslu on 18 Dec 2019
Hello,
I have matrix 'classes
classes =
1
2
What i need is, if classes matrix include x it should say "Matrix 'classes' include x value" ,else "Matrix 'classes' do not include x value".
The challanging think is comparing x with any of the classes members without using for or while loops.

  0 Comments

Sign in to comment.

Answers (1)

James Tursa
James Tursa on 18 Dec 2019
Hints: What does this result give you:
classes == x
Then look at this:
doc any

  3 Comments

betul uslu
betul uslu on 18 Dec 2019
Thank you for answering,
But i do not uunderstand
doc any
What is it doing ?
James Tursa
James Tursa on 18 Dec 2019
Type it into the command line and see what happens ...
You might also try:
doc ismember
betul uslu
betul uslu on 18 Dec 2019
thank you for documnetation :D

Sign in to comment.

Sign in to answer this question.