how to add multiple functions in matlab
I want to add several functions from a single .m file. Is this possible without actu开发者_运维技巧ally having to create an individual m file for each function?
For later versions of Matlab that support the classdef
keyword, I recommend adding the functions as static methods to a class and then calling them from an instance of that class. It can all be done with one .m file:
classdef roof
methods (Static)
function res = f1(...)
...
end
function res = f2(...)
...
end
end
end
and you call them by
roof.f1();
roof.f2();
精彩评论