Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Add this to beam5.m. Run the file and check the output. You should get the same plot you got with beam3.m.

...

Subfunctions

Functions can be called from within a function. You can put multiple functions in one M-file as shown in the example located in this documentation page.

...

Please go through the subfunction page (or local function as MATLAB calls it) in its entirety before watching the following tutorial video. 

...

Now, run main_function in the command window. The result should be the same plot you saw when you ran beam3.m and beam5.m.

Subfunction workspace

The last paragraph of the Local Functions documentation page says that "All functions, including local functions, have their own workspace that are separate from the base workspace". The following video covers this very important concept. 

All functions, including local functions, have their own workspaces
that are separate from the base workspace. 
That brings us to the end of this tour. Before we part, let's remind ourselves of some important programming guidelines that we have followed in this tour:

...