NaN value in data tip causes error

조회 수: 2 (최근 30일)
David K
David K 2022년 3월 10일
댓글: Mathieu NOE 2023년 11월 29일
I am using dataTipTextRow to create custom data tips for my plot. I have found that when there is a NaN value in the Value field, I get an error when I click on the associated marker in the plot. Instead of my custom data tip I get the following text in a box:
Error unable to convert 'string' value to 'char'
The other points in the same plot object are able to display their data tips properly. I haven't figured out a way to determine exactly which line of code this error is happening on. Any ideas on how to fix this?
  댓글 수: 2
VINAYAK LUHA
VINAYAK LUHA 2023년 11월 29일
Hi David,
I tried to reproduce the issue in MATLAB R2023a with the following code and it worked just fine with all the datatips, even the ones with value=nan shown correctly.
x = 1:10;
y = rand(1, 10);
values = ["a","b",nan,"d","e","f","g","h","i","j"];
s=scatter(x, y, 'filled');
row = dataTipTextRow('label',values);
s.DataTipTemplate.DataTipRows(end+1) = row;
If the issue is still persistent, please share your code and the MATLAB version in which you are facing the error.
Regards,
Vinayak Luha
Mathieu NOE
Mathieu NOE 2023년 11월 29일
works fine even with the older R2020b

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by