필터 지우기
필터 지우기

Str2double gives NAN

조회 수: 4 (최근 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
Doli Swey
Doli Swey 2020년 10월 17일
thank you
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