フィルターのクリア

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:
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:
...but no error telling me something was awry that would justify the red question mark in the Live Editor.
Does anyone have any idea?

採用された回答

Cris LaPierre
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.
  • 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.
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)
Region 2 
for t+3>=-2 and t+(7-D) =2 
Both of these look like issues that should be reported to MathWorks support. You can do that here.
  3 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 11 月 5 日
編集済み: Cris LaPierre 2021 年 11 月 5 日
Here's a workaround for the '<'. This uses &ge; for '>=' and &le; for '<='.
syms y t;
y=(-t-2);
eq="(S+1)*int(y,t,t+3,3)";
eqstr=["'Region 2 '"; eq ; "'for t+3 &ge; -2 and t+(7-D) &le; 2 '"];
displayFormula(eqstr)
Region 2 
for t+3 ≥ -2 and t+(7-D) ≤ 2 
Dimitri
Dimitri 2021 年 11 月 5 日
That is great. Thank you so very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Symbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by