Skip to content

2. MATLAB Basics

Crystal Coolbaugh edited this page Mar 15, 2019 · 2 revisions

Getting Started

MATLAB is an interactive program for numerical analysis and data visualization. These instructions provide a very basic overview of information needed to get started with FloWave.US.

MATLAB Tutorials

If you have not used MATLAB before, we recommend reviewing some of the links and short tutorial videos on the Getting Started with MATLAB site to orient to the MATLAB environment.

Important Topics

For more detailed instructions about using MATLAB, please refer to other tutorials available at Mathworks.

Opening MATLAB

The following is a basic view of MATLAB when the program is first opened (your view may differ depending on your default preferences):

MatlabHome

What is the MATLAB Search Path?

MATLAB uses a search path to locate files. For FloWave.US to work correctly, all of the source code must be added to this search path.

If a folder, subfolder, or file is not on the search path, MATLAB will return an error message ... "undefined function or variable XX".

The Current Folder Menu Bar lists the folder location MATLAB is actively referencing. At startup, the default location is "Documents/MATLAB".

MatlabHome_Path

To run a m-file or function, the file must be in the MATLAB folder location or added to the MATLAB path.

Click on the "green arrow - folder" button to browse to a new folder location. The Current Folder display on the left of the home screen displays the contents of the reference folder.
MatlabHome_CurrentFolder

You can check to see if a folder is on the search path by looking at the "Current Folder" panel in the MATLAB desktop. Folders on the path will be in bold text. Folders not on the path will be in gray text. Right click on a folder and select "Add to Path" option to allow MATLAB to reference the folder and subfolder contents. These selected folders will reset when MATLAB is closed.

NOTE: Result files created by FloWave.US will be listed in the current folder when the analysis is completed.

Entering Commands

Commands, input, or file names can be entered into the Command Window Prompt.
MatlabHome_Command

Statements can be typed after the >> symbol. After you type a command, press "ENTER" to execute the instruction. Casing, spelling, and spaces are important when entering commands. Additional characters or spaces will result in an error. When entering filenames, be sure to include the file type extension (e.g. ".csv", ".xls", ".jpg").

If the >> symbol is not visible, the code may be processing data. You can check the status of the code ("BUSY", "PAUSED", "READY") in the status bar in the lower left side of the screen.

MatlabHome_Status

If the program is paused, the user must hit a key on the keyboard for the program to advance to the next phase.

Exiting MATLAB

To exit MATLAB, click on the close box ('X') in the MATLAB desktop. If you enter an incorrect command or wish to restart the program, you can exit at anytime by pressing "ctrl+C". Restart the program by entering the m-file name in the command window.