- It appears when a string ends with a number, it is automatcally getting subscripted in a live script. Place a space after the number to avoid the subscripting.
- Removing the "<" fixes the red diamond with a question mark. I realize you need it. I just haven't figured out how to do that.
displayFormula in LiveScript giving me a red triangle with a question mark - and NO explanation!
조회 수: 9 (최근 30일)
이전 댓글 표시
Can someone tell me why this code:
syms y t;
y=(-t-2);
eq="(S+1)*int(y,t,t+3,3)";
eqstr=["'Region 2'"; eq ; "'for t+3>=-2 and t+(7-D)<=2'"];
displayFormula(eqstr)
gives me the following output:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/790154/image.png)
Specifically, why the heck am I getting that red triangle with NO explanation in the Live Editor, and also "Region 2" has the 2 as a subscript?
When I run the code in the interpreter, things work fine and I get the following:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/790159/image.png)
...but no error telling me something was awry that would justify the red question mark in the Live Editor.
Does anyone have any idea?
댓글 수: 0
채택된 답변
Cris LaPierre
2021년 11월 5일
편집: Cris LaPierre
2021년 11월 5일
I can't say why it is doing what it is doing. However, some playing around determined the following.
syms y t
y=(-t-2);
eq="(2+1)*int(y,t,t+3,3)";
eqstr=["'Region 2 '"; eq ; "'for t+3>=-2 and t+(7-D) =2 '"];
displayFormula(eqstr)
댓글 수: 3
Cris LaPierre
2021년 11월 5일
편집: Cris LaPierre
2021년 11월 5일
Here's a workaround for the '<'. This uses ≥ for '>=' and ≤ for '<='.
syms y t;
y=(-t-2);
eq="(S+1)*int(y,t,t+3,3)";
eqstr=["'Region 2 '"; eq ; "'for t+3 ≥ -2 and t+(7-D) ≤ 2 '"];
displayFormula(eqstr)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!