MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
Control Description Configuration Details
Button Use button controls to
interactively run code on button
click.

When using button controls,
consider setting the Run field for
all other controls in the live script
to None. Then, the code only runs
when the user clicks the button
control. This can be useful when
the live script requires multiple
control values to be set before
running the code.

To change the label displayed on
the button, in the Label section,
enter a label name.

Labels


To specify the label that you want to display next to the control when the code is hidden,
in the Label section, enter a label name. This is also the text that displays on button
controls in all views.


To hide the code and only display labeled controls, output, and formatted text, click the


hide code button to the right of the live script. You also can go to the View tab, and in


the View section, click Hide Code. To show the code again, click the output inline


button or the output on right button.


Execution


By default, when the value of a control changes, the Live Editor runs the code in the
current section. To configure this behavior, in the Execution section of the control
configuration menu, specify these fields:



  • Run On (slider control only) — Select Value changing to run the code while the
    value of the slider is changing. Select Value changed to wait until the slider value is
    done changing (user has released the slider thumb).

  • Run — Select from the available options to determine what code runs when the value
    of the control changes. For example, Current section to only run the section that
    includes the control when the control value changes. Select Current section to end
    to run the section that includes the control and any sections that follow.


Add Interactive Controls to a Live Script
Free download pdf