view m-toolbox/classes/+utils/@models/displayModelOverview.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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