Is there any way to use a function defined in the workspace inside a function defined in a .m file?
Show older comments
I trying of use fmincon and for that I have to create a function with de nonlinear constrains, but when creating the function that contains the nonlinear constraints should I use some functions defined in the workspace, but apparently did not exist within the function workspace (.m file).
I have:
function [ci,ce] = nonlinears(z)
ci=cineq(z(1),z(2),z(3),z(4));
ce=ceq(z(1),z(2),z(3),z(4));
end
where cineq and ceq are functions defined in the workspace.
I wonder if there is any way to use the functions defined within the worskpace in the function worskpace.
Please help! and thanks in advance!
Accepted Answer
More Answers (1)
Make sure you are aware of and understand the differences between Local Functions, Nested Functions, and Anonymous Functions
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!