Programmatically add annotation with an equation to simulink

6 Ansichten (letzte 30 Tage)
Cedric Kotitschke
Cedric Kotitschke am 13 Feb. 2023
Hey all,
I'm trying to add an annotation to a Simulink model which includes an equation using Latex syntax. However, all I get is the plain text.
latexString = 'x = \frac{1}{2}'
h = Simulink.Annotation(gcs, latexString);
How exactly do I do this?
Thanks!

Antworten (1)

Bhavana Ravirala
Bhavana Ravirala am 13 Feb. 2023
Bearbeitet: Bhavana Ravirala am 13 Feb. 2023
Hi Cedric,
To add a Latex equation to a Simulink annotation, you need to use the Latex interpreter by setting the 'Interpreter' property of the annotation object to 'latex'. Refer the code below:
latexString = 'x = \frac{1}{2}';
h = Simulink.Annotation(gcs, latexString);
set(h, ' Description', 'latex');
You can also use the function ‘pslinkfun’ to programmatically add annotations to a block in a model.
Please refer to the documentation below for more information.
Hope this helps!!
  1 Kommentar
Cedric Kotitschke
Cedric Kotitschke am 13 Feb. 2023
But there is no option to set the interpreter to latex. There is only off, rich and tex. Also, you changed the description parameter and not the interpreter

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Environment Customization finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by