Repository navigation
3. Creating Scripts in MatLab
Arduinerd edited this page May 24, 2018
·
4 revisions
It is possible to run multiline commands within the command window, however, it is more difficult to edit and less readable.
- Choosing function from the NEW button will create the template for a function in a new Editor window
- Opening an Editor window will open the EDITOR, PUBLISH, and VIEW tabs in the ribbon
Pressing ALT+ENTER next to a squiggly line will apply the recommended fix
- Choosing the example button from the NEW button will give a new file showing a title and two sections
- Choosing class from the new button will open a new class definition
- In order to invoke a script you must be in the same file location
- If you are not in the same folder, you must add it to the MatLab path
- Trying to run the function from a different location (while it is open) will prompt you to set the path
- Under the find files button, you can search for a file name, file text, or others
- You can restrict your search in several ways
- The comparison button allows for text comparison to see where text is added or deleted
- You can save the result as an html file
- Breakpoints pause the program at a particular point
- Breakpoints can be set by clicking the line number, selecting the menu item, or pressing F12
- Within the EDITOR tab you can control execution after hitting a breakpoint
- By creating comments within sections, you can creates paragraph text that will appear upon pressing the publish button in the PUBLISH tab
- You can format the text in several ways to appear as a html file
- After adding code, both the code and the result will be visible after publishing
- You can add LaTex formulas in the middle of a paragraph
- Within the Symbolic Toolbox is the MuPAD notebook which helps write LaTex
- The app allows your to copy the input as LaTex code
-
syms xcalls the Symbolic toolbox -
latex(“function”)will print out the LaTex code for a function from the command line - LYX is a program which will achieve the same effect
LaTex is documentation preparation system which allows users to input mathematical formulas as plain text. It is preferred by most of the academic world for papers and other official documents.
- functions require input and output arguments
function [out1, out2] = functionName (in1, in2,…)