Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
May 24

How to Generate Report Automatically From Matlab

Posted by abiao at 15:39 | Code » Matlab | Comments(14) | Reads(23054)
Often we have to generate reports to our boss, colleagues, and clients, etc. Generally those reports include Matlab source codes, maths equations, and possibly graphs. How do you generate your reports? writing down your equations in Word, running your matlab codes, copying and pasting the results?
Open in new window

It is all right to do like that, but the whole process becomes extremely simple with the cell mode in Matlab, it generates report automatically for us, any change you make regarding description, codes and results will be updated by clicking a simple button: Publish to HTML.

The following steps outline the procedure,
First, opening an editor in Matlab by choosing File -> New -> M-file;
Second, selecting cell and enable cell mode in the editor;
Third, inserting cell divider under cell window, it allows you to type a name for each section, similar with the title for chapters in Word;
Fourth, depending on your reports, inserting Text Markup, where you are able to insert description text, bold text, etc. most importantly, it supports TeX equations;
Finally, clicking "Publish to HTML", a nice-looking report is generated, and if necessary, changing the codes and re-running to update the report.

For a simple demonstration, I write the files as follows.
%% Cell mode publish demonstration
% abiao @ mathfinance.cn

%% Using Black Scholes formula as an example
% The value of a call and put options in terms of the Black–Scholes parameters
% is:
% $$C(S,t) = SN(d_1) - Ke^{-r(T - t)}N(d_2) \,$$
% $$P(S,t) = Ke^{-r(T-t)} - S + (SN(d_1) - Ke^{-r(T - t)}N(d_2)) = Ke^{-r(T-t)} - S + C(S,t)$$
% $$d_1 = \frac{\ln(\frac{S}{K}) + (r + \frac{\sigma^2}{2})(T - t)}{\sigma\sqrt{T - t}}$$
% $$d_2 = d_1 - \sigma\sqrt{T - t}$$

%% Sample code, for simplicity, I use the embedded command
[call, put] = blsprice(10,9,0.02,2,0.3);
fprintf('Call option value is %g. \n',call)
fprintf('Put option value is %g. \n',put)
call1 = [];
put1 = [];
for i = 1:10
    call1(i) = blsprice(5+i,9,0.02,2,0.3);

%% Sample plot for demonstration only
plot(5+(1:10), call1)

The final report is shown at http://www.mathfinance.cn/attachment/CellPublishDemo.html, looks fantastic.

Great functions!!

btw, the new theme is simple and nice, except for the huge Citi banner on the topsmile little bit wierd...
Thanks for your compliment and support, nychole. Regarding the banner, I will think about re-position it. zan
assignment service Homepage
How many reports are there? I need some of them so that I can learn something about assignment service and I need to do it asap. It will help me to know the things that we are going to work on.
wordsdoctorate Email Homepage
[b].  Thanks for sharing amazing information!!!!!!        
Please keep up sharing.[b]
العاب كمبيوتر مجانا Homepage
You have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you
hero instinct Homepage
Your blogs further more each else volume is so entertaining further serviceable It appoints me befall retreat encore. I will instantly grab your rss feed to stay informed of any updates.
bd memorial school Homepage
This is some thing very informative and point to point. There is no round and round in this article. Like this smplicity . This clears my old point of view. THANKS
E Juice Steals Coupon Codes Email Homepage
What a great intuitiveness and ideas about blogs and articles. I enjoy and get helpful information about online businesses as well as current issues and different topics.  Code saver presents an excellent place to use unbelievable discount and premium deals in daily routine
One of the greatest sites I've come across in a while.
need for speed no limits hack
samuelddarden Email
Merely wanna admit that this is handy , Thanks for taking your time to write this. cf vanguard
Michael A. Ramos Email
This new method has little bit change from the old one. New wings has been added
or the new mod which we don`t see in old one. It is little hard and I found difficult in using this new generation of report in the office work. After reading an article from grademiners review blog about the tricks and how to generate it using easily it has become more easy now.
Maria Lena Email
The best way to know more about Matlab or any thesis help, the best approach is to click on assignment writing service uk. They will assist you & provide complete material as you want within your time duration.
junior golf camps Email Homepage
Thanks for sharing the information!
altoconvertpngtopdf Homepage
You've shared an astounding article here, and I am satisfied with the substance shared here. I am working for altoconvertpngtopdf, so I can impart this substance to my partners now, and they will welcome me for this.
Pages: 1/1 First page 1 Final page
Add a comment
Enable HTML
Enable UBB
Enable Emots
Nickname   Password   Optional
Site URI   Email   [Register]