Publishing in matlab

Hello,
For a coursework I have to answer a question of two parts and publish them. The first part of the code is write a function, and the second one is run it for different values.
My problem is that I want to publish the two codes without running/executing them, and then I want to show that my function works by running it for ONLY 1 value (whereas in part 2 it runs it for lots of values that I do not want to display.
So basically, I want it to look like this:
%%Title
function ... end
%% Explanations
for values ... function... end
%% Example
run function for 1 value
the problems I've encountered so far is: - I can publish everything but not run my fct for 1 value - I can run it for one value but then it runs everything (including the function with unspecified values) - I can do it on 2 separate mfiles but not on 1.
Thank you very much, I hope I was clear!
thank you very much!

1 Comment

From what I understand, if you suppress your function output by using a semicolon after the call, it shouldn't run it for you in the published file.

Sign in to comment.

Answers (1)

Oleg Komarov
Oleg Komarov on 15 Feb 2011
You can go this way:
%%Title
type('myFunc.m')
%%Explanations
%%Example:
myFunc(1)
The point here is that you lose the M highlighting.
Another way would be to type directly the content of the function which will give you the error and then merge the two htmls editing them manually in order to keep the colors for the code.
Oleg

Categories

Asked:

on 15 Feb 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!