Programmatically add annotation with an equation to simulink

조회 수: 6 (최근 30일)
Cedric Kotitschke
Cedric Kotitschke 2023년 2월 13일
댓글: Cedric Kotitschke 2023년 2월 13일
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!

답변 (1개)

Bhavana Ravirala
Bhavana Ravirala 2023년 2월 13일
편집: Bhavana Ravirala 2023년 2월 13일
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
Cedric Kotitschke
Cedric Kotitschke 2023년 2월 13일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by