function [m,filenameloaded]=mphload(filename, name, hist)
% MPHLOAD Load a COMSOL model MPH-file
%  
%   MODEL = MPHLOAD('model.mph') loads a COMSOL model object and assigns  
%   the default name Model in the COMSOL server.
% 
%   MODEL = MPHLOAD('model.mph', 'ModelObjectName') loads a COMSOL model 
%   object and assigns the name ModelObjectName in the COMSOL server.
% 
%   MODEL = MPHLOAD('model.mph', 'ModelObjectName', '-history') turns on 
%   history recording. History recording is turned off by default when  
%   using MPHLOAD (but not when using ModelUtil.create)
% 
%   [MODEL, FILENAMELOADED] = MPHLOAD('model.mph', 'testmodel') also  
%   returns the filename of the file that was loaded.
% 
%   If the model name is the same as a model that is currently in the  
%   COMSOL server, the loaded model overwrites the existing one.
%   Note that MATLAB will search for the model on the MATLAB path if an 
%   absolute path is not supplied.
%   The extension 'mph' can be omitted.
% 
%   Example:
%     % Load transport_and_adsorption.mph from the Model Library:
%     model = mphload('transport_and_adsorption.mph');
% 
%     % Load stresses_in_pulley.mph without specifying the mph extension:
%     model = mphload('stresses_in_pulley');
% 
%     % Load MyModel.mph with the path specified:
%     model = mphload('PATH\MyModel.mph');
% 
%     % Load effective_diffusivity.mph from the Model Library and return 
%     % the filename:
%     [model, filename] = mphload('effective_diffusivity');

% Copyright 2010-2011 COMSOL
