Skip to content
Snippets Groups Projects
Commit d2faaa45 authored by Jakob Gabriel's avatar Jakob Gabriel
Browse files

misc: new function functionArguments

parent 25807034
No related branches found
No related tags found
1 merge request!8Resolve "strange bug in quantity.Symbolic -> valueContinuous after concatenation"
function names = functionArguments(func)
%FUNCTIONARGUMENTS extracts the arguments of a function handle
% names = misc.functionArguments(func) returns the arguments of the function handle func as the
% string array names
%% Example
% names = functionArguments(@(z, zeta, t) z*zeta+t)
names = split(string(regexp(func2str(func), "(?<=@\().*(?=\))", "match")), ",");
end
......@@ -4,6 +4,11 @@ function [tests] = testMisc()
tests = functiontests(localfunctions());
end
function testFunctionArguments(tc)
names = misc.functionArguments(@(z, zeta, t) z*zeta+t);
tc.verifyEqual(names, ["z"; "zeta"; "t"]);
end % testFunctionArguments()
function testBinomial(testCase)
for k = 1:3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment