www.gusucode.com > rptgen 案例源码程序 matlab代码 > rptgen/rptmagicoo.m
function rptmagicoo(ranks, type, showReport, showStatus) %RPTMAGICOO Generate a magic-squares report % RPTMAGICOO() generates an HTML report on magic squares of size % 10, 20, 40, 75. % % RPTMAGICOO(RANKS) generates an HTML report on magic squares specified % by an array of square sizes. % % RPTMAGICOO(RANKS, TYPE, DISPLAY) displays the report if DISPLAY is % true. % % RPTMAGICOO(RANKS, TYPE, DISPLAY, STATUS) displays status messages % generated by report if STATUS is true. % Copyright MathWorks, 2013-2014. switch nargin case 0 ranks = [10, 20, 40, 75]; type = 'html'; showReport = false; showStatus = false; case 1 type = 'html'; showReport = false; showStatus = false; case 2 type = lower(type); showReport = false; showStatus = false; case 3 showStatus = false; end % The following lines register a listener for DOM API status if showStatus dispatcher = mlreportgen.dom.MessageDispatcher.getTheDispatcher; el = addlistener(dispatcher, ... 'Message', ... @(src,evtdata) disp(evtdata.Message.formatAsText)); end rptname = 'magicoo'; % Create an instance of the magic report class. rpt = mlreportgen.examples.magic.Report(rptname, type, ranks); % Fill the holes in the magic report's template. rpt.fill(); % Close the report. close(rpt); if showReport rptview(rptname, type); end if showStatus delete(el); end end