Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@models/displayModelOverview.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@models/displayModelOverview.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,46 @@ +% DISPLAYMODELOVERVIEW diesplays the model overview in the MATLAB browser. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: DISPLAYMODELOVERVIEW diesplays the model overview in the +% MATLAB browser. +% +% CALL: displayModelOverview(modelName) +% +% INPUTS: modelName: String with the model name +% +% VERSION: $Id: displayModelOverview.m,v 1.2 2010/10/29 16:11:13 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function varargout = displayModelOverview(varargin) + + % Check the inputs + if nargin ~= 1 + error('### Unknown number of inputs'); + elseif ~ischar(varargin{1}) + error('### The input must be a model name (String)'); + end + + modelName = varargin{1}; + + txt = modelOverview(feval(modelName, 'info')); + + % Workaround for the broken anchor tags in the HTML page. + % It is necessary to write the HTML page to disk. + dynamicHelpPath = fullfile(prefdir(), 'dynamicHelp', 'models'); + + if ~exist(dynamicHelpPath, 'dir') + mkdir(dynamicHelpPath); + end + + filename = sprintf('%s.html', modelName); + + file = fullfile(dynamicHelpPath, filename); + + fid = fopen(file, 'w'); + fwrite(fid, txt, 'char'); + fclose(fid); + + web(file, '-new', '-noaddressbox'); + +end