MATLAB Tutorials

  These instructions are specifically for using MATLAB on machines located in the MLC computer lab. These applications should be installed on most, if not all, computers located on campus. If you would prefer to use a computer outside of the MLC computer lab, certain steps may be slightly different, such as where the program is located on that computer and how to print your finished assignment(s).


Opening MATLAB


   Log into your ONID or science account on one of the computers in the computer lab. If you do not have a science account, for your username put onid\username. Once you log in, find the icon MATLAB R2010b and get started.

Run Tutorials

  Once MATLAB is open, you will notice that the screen is divided into multiple areas. In the largest section in the middle, type in 'demo' and press enter. The MATLAB Demos window will open up; this screen contains all of the tutorials for MATLAB. On the left hand side of this window is a section titled MATLAB. Click the '+' next to it to show all of the MATLAB tutorials by subject. Start by watching the first few videos under 'Getting Started'. The videos have audio, so please use headphones so that you do not disturb anyone else in the computer lab. After watching the first few introductory videos, you can look for tutorials specific to the type of work you need to accomplish with MATLAB and run through those. These are not neccessarily videos, and may simply be walkthroughs.

Using Help

  Once in MATLAB, from the command window you can get help with the functions of MATLAB. If you type in 'help' then a list of topics will come up that MATLAB has information on. You can also type 'help functionname' and information on that function will come up. Another way to get information on a function is to type 'doc functionname.' Instead of showing up in the command window, the information will appear in new window. Using the help command is a great way to understand new functions you have never encountered before.

Saving Your Work

   It is always good to constantly save your work. You have a couple different options to save your work. If you want to access it on any computer on the OSU campus, then save the work to your O drive. In order to do so, after you go to file and click on 'save as' you need to go to 'My Computer.' From there you want to click on 'homes on 'ONID File Server (onid-fs)'(O:)' and save the file there. If you want to have access to the file at your home computer, then you need to save the file (preferably in your O drive) and attach it in an email to yourself. If you do not have MATLAB installed on your home computer, it may not be able to open .m files. If this is the case, save your work as above and then copy whatever you need into a different file format, such as a word document. Save this file and attach it to yourself in an email.   

Finished Assignments

Once you are finished with your assignment, and have the code that needs to be turned in correctly, you have a few options.

    Printing- The first option is to simply print from MATLAB. Due to how much white space there is in MATLAB though, this will use quite a bit of paper, and since printing in the MLC computer lab costs $0.05 per page, there is a more eco-friendly option. Copy and paste the MATLAB document into notepad. Then you can delete the blank lines, resulting in a lot less paper used. Once you are ready to print, go to File->Print. Make sure the selected printer is 'HP Laser Jet P4015x'. Then select print to print your assignment.

    Publishing- Another option is to 'publish' your MATLAB document. MATLAB's 'publish' feature is a very convenient way to compile your code and all outputs and graphs into a single file. The default format is HTML, but you can publish your work in a variety of formats including pdf, doc, and latex.

To publish in HTML, click the publish icon to the right of the print icon in the Editor menu bar at the top of the Editor window. To publish in a different format, find 'Publishing Configurations for filename' under the File drop down menu in the Editor window. Click on 'Edit Configurations for file name' and a new window will appear. The first line in the lower righthand box should read 'Output file format html.' Change the file format by clicking on html and selecting your desired format from the drop down menu. Click publish. MATLAB will show you a preview of it, and then you may print it or send it as an email attachment.

Additional Links

MATLAB Notes   Introduction focusing on number formatting and arrays.
MATLAB Tutorial   Tutorial focusing on matrices, plots, and models.
MATLAB Reference Sheet   Helpful for remembering MATLAB specific syntax (sin, cos, rand, pi, etc.).

Last updated May, 1, 2012