Use variable values froma code block directly in a Live Script text cell (inline evaluation)

52 vues (au cours des 30 derniers jours)
Randall
Randall le 21 Déc 2025 à 16:15
Déplacé(e) : Matt J le 22 Déc 2025 à 17:19
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 commentaires
Walter Roberson
Walter Roberson le 21 Déc 2025 à 23:13
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
Randall le 22 Déc 2025 à 0:36
You are right, I thought it was from MATLAB help but I used CoPilot Chat to answer the question. CoPilot states the following. Did it just make it up?
In MATLAB Live Editor, you can display a variable’s value inline inside a text box (formatted text cell) using inline evaluation.Method 1 – Backticks (Live Editor Inline Evaluation)
MATLAB Live Editor supports inline variable evaluation using backticks:

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 22 Déc 2025 à 0:59
Déplacé(e) : Matt J le 22 Déc 2025 à 17:19
I believe it just made that stuff up.
  1 commentaire
Randall
Randall le 22 Déc 2025 à 1:25
Déplacé(e) : Matt J le 22 Déc 2025 à 17:19
Wow, I have to admit its an eye opener, so much for AI. Thanks.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Function Creation dans Help Center et File Exchange

Produits


Version

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by