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

8 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2019 年 8 月 7 日
回答済み: MathWorks Support Team 2019 年 8 月 9 日
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 Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by