Search code examples
formatnumbersdecimalscilab

xstring + format decimal number + scilab


I am not getting to format strings using xstring command. For example:

Mp=54.5666666

xstring(1,1,'$\LARGE Mp={'+string(Mp)+'}%$')

I want only: Mp=54.56% How do I do? Besides this, it is possible to define some position using "xstring" only by click in figure? "Fontsize" command doesn't work in xstring? Can anybody help me? Best regards.


Solution

  • You had the answer to the first part of your question on the Scilab's users mailing list:

    http://mailinglists.scilab.org/Scilab-users-xstring-format-decimal-number-tp4041406p4041407.html

    For the remaining questions:

    1. you can use xclick to get the screen coordinates and give them to xstring:
    [f,x,y]=xclick()
    xstring(x,y,"Some text")
    
    1. changing the font size of the text can only be done afterwards like this
    xstring(x,y,"$y=\frac{1}{1+x^2}$")
    gce().font_size=5
    

    A remark: you don't need to use LaTeX size commands (like \Large) as changing the font_size attribute also scales the LaTeX output.