How to submit your work in MATLAB

This page includes instructions for how to publish your MATLAB work so that it may clearly be read. So follow these steps before submitting your homework in MATLAB.


In the command window type: edit('Homework_1.m');

Inside the file Homework_1.m, type in the MATLAB code as usual

for i = 1:10
   a(i) = i^2;

From the MATLAB editor, click: File > Save File And Publish ...

This will create an html document including your code in a nicely formatted boxes.

disp('Or, click the icon to the right of the print icon');

Use the symbol %% (double percent) to make dark bold "English" lines

disp('Commenting your code well helps everyone.');

Use a % (single percent) to make light thin "English" lines.

This line was created by putting a single % sign in front. This is handy when you need to write a lot of English to explain your work.

% Sample code
[min_a, ix] = min(a);

Another Method

These two commands can also be used for publish.

% This command creates the html file
% This command views the html page


This is what the professionals say.

MATLAB Blog on How to Publish m-files