Effacer les filtres
Effacer les filtres

Is there a way to have LiveScript buttons call arbitrary functions?

3 vues (au cours des 30 derniers jours)
Edward Gatzke
Edward Gatzke le 14 Fév 2023
Commenté : Edward Gatzke le 16 Fév 2023
Currently, it appears the LiveScript Button control only has options to run the script or run a section or do nothing.
I have LiveScripts with functions included at the bottom that appear to run whenever a LS control changes values.
Is there a way to have a LS button run a user-defined function?
I have sorta found a way, include a check box assigned to a variable. In the section, send the variable to a function and the function executes if the check box is checked. However, the function will execute every time the script re-runs unless the user unchecks the box. (is there a way to script changes to UI values or reset default values by script? Currently you have to click each control to reset it AFAIK).

Réponses (1)

Matt J
Matt J le 14 Fév 2023
  1 commentaire
Edward Gatzke
Edward Gatzke le 16 Fév 2023
WRT to custom editor tasks, it looks like a non-simple path for basic users. If I give students a file, I want them to just run it in MATLAB and not have to install tasks, etc. They will already have enough trouble because Windows will name any second copy they download with a ' (1)' extension and break MATLAB file naming conventions.
I think I found a better way using dialog boxes like the one linked below. All the code can be included in the LiveScript file and once a student has completed the exercise the dialog box can pop up and they can submit their answers or try again.
Thanks for your help.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by