Viewing the m-files through the browser does NOT work nicely with Microsoft IE. Use another browser like Mozilla Firefox or Safari instead.
If you're reading this page, it's probably because you've been asked to "publish" your script file in MATLAB. To do this, you must format your .m file (for example, NAMED examplefile.m) in a specific way and put it in a specific location on your G-drive.
Here's a list of what you need to do:
- On your G-drive, create a directory/folder "www" (if you haven't already done so).
- Within the "www" directory/folder, create another directory/folder "loy#" (where # is your student ID number.) See below for how to create directories/folders within MATLAB
- Within that directory/folder, create another directory/folder that signifies the class. For example, create a directory named "ma402".
- Save your m-files (your script and any function files you need) in this directory/folder.
- Format your script file in such a way so that it "publishes" nicely (details below)
- Once it is saved, within the command window in MATLAB, type
publish('examplefile.m', 'html')MAKE SURE YOU HAVE THE CORRECT "CURRENT DIRECTORY" and FILENAME!
- You can view your webpage at
IMPORTANT: in order for your original m-file(s) to be "linkable" on your published webpage, you must create the m-file within the "www" directory/folder or any of its subdirectories/subfolders from here on known as the "www-structure". Also, you can copy the template file (by doing a "save as") directly to the appropriate directory/folder in the "www-structure". If you first work with your m-file in a different place on your G-drive and then copy it over to the "www-structure", it will not have the correct permissions to be viewable from your html page.
To format your script file, use the examplefile.m file or another template file you may be given. An example file named examplefile.m can be found at:
The published page can be seen at:
In order to get full credit, your directories and files must be named correctly and you must have links to your function file and the m-file (script file) that created the webpage, along with the appropriate text, plots, and such to answer the problems.
Remember, these files are SCRIPT files with the comments formatted a special way. I am not going into details of the formatting. Here are 2 examples of the same script but one is "publishable" and the other is an ordinary SCRIPT file:
Basic2DPlotExample2Web.m (publishable version)
NOTE: you can create the directories/folders within MATLAB if you're unsure of how to do it otherwise. To create a folder, in the "Current Directory" window (left of the command window if using the default view), click on the down-arrow to the right of the bluish circular icon and a pop-down list will appear in which you can select "New Folder"
For more information on creating webpages, at the Technology Services webpage, go to: "Information for Students", Click on "Topic: Miscellaneous" so that the "Student Web Pages" link appears and click on that. Or just go here. There you can see some directions along with a document on creating a web page.
Instructor: Dr. Lisa Oberbroeckling
Office: 312 Knott Hall
Email: loberbro "at" loyola "dot" edu