Str2double gives NAN

17 vues (au cours des 30 derniers jours)
Doli Swey
Doli Swey le 17 Oct 2020
Commenté : Ameer Hamza le 17 Oct 2020
Hi,
I would like to do this with the attached string array.
CombinedStim(:,2)==k
It is impossible that CombinedStim is string, whereas k is a double.
I tried to use str2double and got NAN values because the first column contains strings, whereas second column is numbers.
Then i try regexp, however I was not succesfull again.
Is there any way I can make this work?
Thank you

Réponse acceptée

Ameer Hamza
Ameer Hamza le 17 Oct 2020
Modifié(e) : Ameer Hamza le 17 Oct 2020
What about only converting second column to double
str2double(CombinedStim(:,2)) == k
Or using num2str and then use strcmp()
strcmp(CombinedStim(:,2), num2str(2))
  3 commentaires
Doli Swey
Doli Swey le 17 Oct 2020
thank you
Ameer Hamza
Ameer Hamza le 17 Oct 2020
I am glad to be of help!
You can start a new question of there is some other problem unrelated to current question.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by