function varargout = getParameterNames(m, name)
% function getParameterNames(m, parameterString)
% 
%  Finds all parameters with part of their name matching parameterString,
%  and returns their index, name and value.
% 
% Inputs: m is a model
%         parameterString is the part of the parameter name to look for.
% 
% Outputs: none; getParameterNames prints a list.
% 
% See also:
%     getSpeciesNames

% This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative 
% Works 3.0 United States License. To view a copy of this license, visit 
% http://creativecommons.org/licenses/by-nc-nd/3.0/us/ or send a letter to Creative Commons,
% 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

indCell = strfind(m.pNames, name);
for i = 1:length(indCell)
    ind(i) = ~isempty(indCell{i});
end
ind = find(ind);
nameList  = m.pNames(ind);
paramList = m.p(ind)';

if nargout > 0
    varargout{1} = ind;
    varargout{2} = nameList;
    varargout{3} = paramList;
else
    disp(sprintf('Ind   \tName    \tVal'));
    for i = 1:length(ind)
        disp(sprintf('%d   \t%s   \t%f', ind(i), nameList{i}, paramList(i)));
    end
end