Presentation is loading. Please wait.

Presentation is loading. Please wait.

Scripts In Matlab.

Similar presentations


Presentation on theme: "Scripts In Matlab."— Presentation transcript:

1 Scripts In Matlab

2 Scripts A script is a file that contains many lines of code.
You can edit the code using Matlab’s Editor. Once you have the code set up the way you want it, you can have Matlab run the entire script from the Command Window by typing in the name of the script. Matlab will execute one line at a time (going from left to right and top to bottom) until the whole script has been executed. Matlab scripts end with the extension .m and are called m-files. They are basically text files and can be edited with any text editor.

3 Scripts

4 Scripts The advantage of using a script is that we can easily change a small part and re-run the whole thing to find the new result.

5 Scripts Increased value

6 Scripts You can also run scripts directly without having to type in the name at the Command window by clicking on the green triangle.

7 Scripts If you close Matlab and then re- open it, your script will still be there in the Editor. If you have many scripts open at the same time, you can click here to see all of them.

8 Scripts If you close Matlab and then re- open it, your script will still be there in the Editor. If you have many scripts open at the same time, you can click here to see all of them. These ones are hidden. These ones are currently visible in the open tabs.

9 Matlab’s Search Path The search path is a list of all the directories where you have m- files that you want Matlab to be able to run. M-files that are not in folders on Matlab’s search path can not be run from the Command window. You can get around this by changing directories to the folder where your desired file is. cd means “change directory.” In this case, we are changing directories to D:\Matlab. The argument to cd must be in single quotes.

10 Matlab’s Search Path You can also change directories by clicking on this icon, which brings up a file explorer window.

11 Matlab’s Search Path You can add folders to Matlab’s search path by clicking on the “Set Path” icon.

12 Matlab’s Search Path To add a folder, click here.
To add a folder and all of it’s sub- folders, click here. To specify which folders Matlab should check first you can organize your folders by highlighting one in the display and clicking on “Move to Top,” “Move Up,” “Move Down,” or “Move to Bottom.” You can remove folders by clicking here. When you’re done, click “Save” and then “Close”.


Download ppt "Scripts In Matlab."

Similar presentations


Ads by Google