use of strcmp with two conditions
4 views (last 30 days)
Show older comments
Hi
I am wondering whats wrong with this code:
filtered=(min_tabell(strcmp(min_tabell.best_salt_1_n_best_salt_2,'NH4Cl',:)||(strcmp(min_tabell.best_salt_1_n_best_salt_2,'NaCl',:))))
the error that I get
Undefined function or variable 'strcmp'.
0 Comments
Answers (2)
DGM
on 3 Jul 2022
Edited: DGM
on 3 Jul 2022
Just a guess, since I have no idea what your array content or size are.
strcmp() takes two arguments, but you're feeding it two arguments while simultaneously trying to index into it like an array.
things = {'b','a','NH4Cl'}
filtered_ok = strcmp(things,'NH4Cl')
filtered_bad = strcmp(things,'NH4Cl',:)
If you're trying to select all columns of the selected rows in min_tabell, then do that outside the calls to strcmp().
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!