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

6 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 7 Août 2019
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');

Plus de réponses (0)

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by