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 个评论
Kaustubha Govind
2011-2-15
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.
回答(1 个)
Oleg Komarov
2011-2-15
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
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!