0

I am creating a function in matlab which extracts data out of different functions. I have 6 different functions which are really basic. My goal in the function I am building is to extract the input\output variables as a cell array and display the results in a structure. For example , I extracted the name of the function to a structure.

% This function extracts the name of the function in the function path , as
% well it gives information on the input and output variables
function info=extractInfo(functionPath)
% A simple function which returns the path of the function(p) , the name
% (name) and the extension (e)
function name=getFuncName(funcPath)
[p,name,e]=fileparts(funcPath);
end
% Get the name of the function
name=getFuncName(functionPath);

input=????
%insert into struct form
info=struct('functionName',name);

end
  • Do you know how many output arguments the functions produce? – Jonas Dec 27 '13 at 07:35
  • 1
    you can use nargin and nargout to get the number of input and output variables respectively but you need a function handle to do it, you can parse the m-file as well, see http://stackoverflow.com/questions/10431577/how-do-i-retrieve-the-names-of-function-parameters-in-matlab – Paweł Kordowski Dec 27 '13 at 11:02

0 Answers0