Str2double gives NAN

5 次查看(过去 30 天)
Doli Swey
Doli Swey 2020-10-17
评论: Ameer Hamza 2020-10-17
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

采纳的回答

Ameer Hamza
Ameer Hamza 2020-10-17
编辑:Ameer Hamza 2020-10-17
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 个评论
Ameer Hamza
Ameer Hamza 2020-10-17
I am glad to be of help!
You can start a new question of there is some other problem unrelated to current question.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by