"text" Function Does Not Accept Inputs of Type Single.

조회 수: 9 (최근 30일)
The function "text" does not accept inputs of type single. Is there any existing workaround?
The follow code block produces an error when passing variables of type single as input into the "text" function.
figure()
axes()
xlim([0 10])
ylim([0 10])
text(single(5), single(5), "My String");
Error using text
First two or three arguments must be numeric doubles.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2019년 8월 7일
One possible workaround is to cast the variables of type single into type double. The "Position" name-value pair can also be used to specify variables of type single as the x and y coordinates of the text position. Below is a brief snippet demonstrating this workaround.
figure()
axes()
xlim([0 10])
ylim([0 10])
text('Position', [single(5), single(5)],'String', 'My String');

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by