Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Publishing a class definition to html

Asked by Frances on 24 Jul 2012

I'm publishing several tutorials to html for a webpage. One of the tutorials I have written is about how to define your own classes in my matlab toolbox. I have an entire class definition in it as an example, interspersed with comments explaining it. The problem is that matlab thinks I actually want this to be a class, because my file starts with

classdef class < superclass

and has properties and functions defined in it. It gives me an error when I try to publish because the name of the file and the name of the class defined in it aren't the same. However, I don't want to change the file name to match because then this will actually be a class. A class with this name already exists in my toolbox, and I don't want an extra to be floating around.

Commenting out the classdef line produces errors as well because I have properties and functions defined. I would basically have to comment out all my code to avoid an error.

Right now, the file will publish, but it prints out an error message at the bottom. This is okay, but not ideal. I'd like to be able to do one of these things:

1) Prevent this error message from being printed to my html file

2) Prevent matlab from recognizing this file as a class

0 Comments

Frances

Products

No products are associated with this question.

2 Answers

Answer by Honglei Chen on 24 Jul 2012
Accepted answer

If you don't care whether the class can run or not, I think you could use the markup for highlighted code sample

http://www.mathworks.com/help/techdoc/matlab_env/f6-30186.html#bs_uwzr

2 Comments

Frances on 24 Jul 2012

Great, thanks! The only problem was that I was using Matlab 2011a, and this feature doesn't show up until 2012a, so I had to switch versions.

Honglei Chen

Contact us