Use variable values froma code block directly in a Live Script text cell (inline evaluation)
古いコメントを表示
MATLAB help states that using backticks around a variable name will have it replaced with its value when its inline in a text block.I am using the Live Editor and saving as an mlx file. Below is an image of a section of code and I want to state the altitude in a text block. An extensive search of the internet provided these methods but none of them work. The variable name is not replaced by the value. Has anyone else tried this and had it work successfully? I prefer this to a statement in the code to write a sentence, its just cleaner overall. Any suggestions. tips or known examples that work? Trying out 2025b, does not work on 2023b either. Any help greatly appreciated!
Code image:

3 件のコメント
Stephen23
2025 年 12 月 21 日
"MATLAB help states that using backticks around a variable name will have it replaced with its value when its inline in a text block"
I do not see that stated in the Matlab documentation: do you have a specific reference to support your claim?
The livescript documentation does state that you can specify a monospaced font using backticks:
https://www.mathworks.com/help/matlab/matlab_prog/format-live-scripts.html
Walter Roberson
2025 年 12 月 21 日
As far as I know, there is no way to substitute in variables in Live Script.
Are you possibly looking at the instructions for using publish ?
Randall
2025 年 12 月 22 日
回答 (1 件)
Walter Roberson
2025 年 12 月 22 日
移動済み: Matt J
2025 年 12 月 22 日
1 投票
I believe it just made that stuff up.
1 件のコメント
カテゴリ
ヘルプ センター および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!