File and Directory Management

MATLAB use searching path method to found file with *.m extension wich contain script and function. Searching sequence of MATLAB in execute command in the command window step by step is shown as follows, for example we write 'plate' as our command:

-MATLAB tries to identify whether 'plate' variable or not. The process will finish if 'plate' is variable and if not, Matlab assume that 'plate' is a file name with .M as the extension. It will continue to next step

-MATLAB tries to identify whether 'plate' standar function of matlab or not. If yes it will be executed and if no it will continue to next step.

-MATLAB will find Matlab file named plate.m in current directory. It will be executed if it is found and continue to next step if it is not found

-MATLAB will find Matlab file named plate.m in all direcotry which is registered in Matlab path searching list. It will be executed if it is found and will show a message below if not found.

>> plate
??? Undefined function or variable 'plate'


If message above is shown, it can be conclude that :
1. you type the file name incorrectly, or
2. your file is not on the directory known by Matlab

If you believed that you typed the file name correctly, you can do 2 options below:

1. Remove current directory to the directory where the file is located
For example the directory where your file stays is c:/mytraining. Write command below on matlab command prompt :

>> cd c:/mytraining

2.Add your directory to the Matlab path searching directory list.
open tool to manage this path searching by clicking set path on File menu:


Next when the dialog set path is shown, click add folder to choose your file folder. Click save button and finish it by click close button. Now Your directory has registered on the Matlab path searching directory list.


If you choose option 1, every time you run matlab application you should do option 1 again. But if you choose option 2, you don't have to do it again next time, unless your file directory has changed.

0 comments:

Post a Comment