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

4 次查看(过去 30 天)
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).

回答(1 个)

Matt J
Matt J 2023-2-14
  1 个评论
Edward Gatzke
Edward Gatzke 2023-2-16
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by