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

9 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 7 de Ag. de 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');

Más respuestas (0)

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by