if nested functions supported in live scripts
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
feynman feynman
le 27 Fév 2024
Commenté : feynman feynman
le 27 Fév 2024
Are nested functions supported in live scripts? Otherwise, global variables have to be declared as global?
6 commentaires
Dyuman Joshi
le 27 Fév 2024
A function needs to be called by using its name and providing any inputs required to run it. That is the case in both functions (.m) and live functions (.mlx).
If, a function does not require any input to run, you can run it (.m file) by pressing the green button.
However, that is not the case with live function (.mlx file), for which you need to explicitly call it.
Réponse acceptée
Cris LaPierre
le 27 Fév 2024
Modifié(e) : Cris LaPierre
le 27 Fév 2024
To enable the Run button, at the very top of your live script, call your function.
sl
function sl
...
end
Note that the clear is unnecessary, as your function runs in tis own workspace. It will not have anything in it at this point.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Scope Variables and Generate Names dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!