This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Programming Basics

Procedures, control flow, interactive input

MuPAD® supports standard programming structures, such as if-then-else statements and for-, while-, and repeat-loops.

When you have a sequence of commands to perform repeatedly or that you want to save for future reference, store them in a program file. A MuPAD program file is a text file that contains any code snippet that you want to store separately from other computations. Saving a code snippet as a program file can be very helpful when you want to use the code in several notebooks. Typically, a program file contains a single procedure, but it also can contain one or more procedures or functions, assignments, statements, tests, or any other valid MuPAD code.

As a shortcut for simple procedures, create and use functions. Compared to procedures, functions require less complicated syntax. Like procedures, functions let you use the same code for different arguments as many times as you need.

Was this topic helpful?