User guide previous pagenext page

8.5: Running it Go back up one level

When the main function is launched (click here) it first creates the data, then the GUI, then updates the GUI using the data. At this point the function exits and control is returned to the command prompt. Note, however, that the GUI is still onscreen and will still respond to user interaction.

This works because the "shared" variables in the main function are not cleared when the function exits. They are only cleared once the GUI is closed. This is a slightly unusual, but very useful, feature of using nested functions for building applications.

For example:

>> demoBrowser

(Full source code for this application is available here: [ view | edit | run ] )


© 2014 The MathWorks Ltd Terms of Use Patents Trademarks