How do I change the text output in Live Scripts?
49 views (last 30 days)
In a Live Script, I make some calculations and want to print out the result. I am using fprintf to do this. For example:
fprintf('Text value is %s',s);
The live script then prints out:
Text value is text output
How do I change the font, the font size, or the font style of the output?
I have tried to change font size in preferences, but none of the options change the font size of the live script output. If I zoom, it zooms everything (live script text as well as the output).
Thanks for any help you can offer
Ankit on 24 Jan 2022
@Rodney Smith Please try following links to change the font, font size and font style.
fprintf('Hello <strong> bold </strong> world.\n')
I use cprintf - display formatted colored text in Command Window - File Exchange - MATLAB Central (mathworks.com) for changing the font, style etc in MATLAB window. But I didn't tested this on Live Script.
Walter Roberson on 8 Jul 2022
The internal mechanism of getting LiveScript to display graphical representation, is to call
where NAME is either '' or a character vector giving a displayable variable name (to display on the left hand side of '=' in the display)
VALUE is expected to be either a symbolic object or else a table object (if anything else is accepted, I have not seen evidence of that.)
I do not know how tables are formatted for this purpose.
For symbolic objects, the symbolic object has a property mathmlOutput which is normally created by createMathML(X,symSuggestions) where symSuggestions is the descriptor for the "Other actions" contextual menu (like "Copy output", "evaluate with vpa" and so on.) The createMathML call creates the basic MathML for the object by calling mathml() on the object.
If you put a breakpoint in at the right place in @sym/disp.m and you replace X.mathmlOutput with a different character vector of MathML, then you can get LiveScript to display the altered information. For example I was able to bold a term in a symbolic expression.
- repeated calls to matlab.internal.language.signalVariableDisplay() with altered mathmlOutput properties do not seem to have any effect
- calling matlab.internal.language.signalVariableDisplay() outside of @sym/disp.m does not seem to have any effect
So, there might be a way to get arbitrary mathML output... but it is not obvious to program that.
I seem to recall from previous investigation that .mlx is zip'd XML and that for text headers and GIF images that it is encoded in mathML inside the XML. If that memory is correct then if, hypothetically, you could reliably trigger outputing arbitrary mathML then interesting outputs would become possible. Unfortunate that there is no clear way to do this.