incomplete command in TeX text string
1 view (last 30 days)
Show older comments
function []=printpowerf(x,y,z)
%this function print a power function onto the plot
%x and y are coordinates about where you want to put the graph
%z is the the coefficients containing alpha and beta of the power fucntion.
string1=['y=',z(1),'*x^',z(2)];
text(x,y,string1);
end
I'm trying to create a function to help me draw equations on plots. Codes above doesn't draw z values out and command window says incomplete command in TeX text string
0 Comments
Answers (1)
Walter Roberson
on 18 Feb 2016
string1 = sprintf('y = %f * x^{%f}', z(1), z(2))
Remember, using [] concatenation of a numeric value against a string is like using char() on the numeric values, and that means "look in the Unicode tables" rather than "format a number to be printable". Like char(10) does not mean '10', it means Unicode character #10, newline.
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!