필터 지우기
필터 지우기

How do I change the order symbolic variables are displayed in the output in a Matlab Live Script?

조회 수: 4 (최근 30일)
Hi,
As the question says, I would like to change the order Matlab displays symbolic variables in a live script. Currently it seems to alphabetise them but I would prefer to be able to set the order, or at least have them stay in the order I input them.
Also is there any way I can specify subscripts in the output? For example I would like to type Kact in the code and have it displayed as K_{act}.
I know these sound like minor things but I export to latex and it's taking me hours to edit.
Thanks Carla

답변 (1개)

madhan ravi
madhan ravi 2018년 7월 5일
편집: madhan ravi 2018년 7월 5일
Hi! There’s in built latex option in matlab . As soon as you define every variable as syms. For example
syms x y
y=x.^2-sqrt(2)
After you run the code You can type latex(y) in the command window and you will get the specified latex format.You copy the form from matlab and use it in pages via inserting equations. This is how I do often it’s simpler and you don’t have to type latex codes .
  댓글 수: 1
Carla White
Carla White 2018년 7월 5일
Hi, thank you but that's not quite what I meant. Maybe I should have given an example code to better explain :) So if I type in Matlab:
syms ka zp A
AR1=zp*ka*A
Then the output I get is:
AR1 =
A*ka*zp
As you can see it reorders my variables. I would like it not to do this. Ideally I would like to specify the order in which the variables appear in the output so that they are in the correct order when I export it to latex. I was hoping there would be a line of code to do this.
Thanks, Carla

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

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by