Set the scope of a self-written function to global in MATLAB
Assume I have written a function fun(a,b,c) in Matlab and saved it ..\My Documents\MATLAB\fun.m . How can I make it available to all functions in Matlab.
In other w开发者_JS百科ords: What needs to be done in order to call this function from any other matlab-file (script, function) without being in the directory the file is stored in?
I believe you can achieve this effect by adding the file to the path - http://web.cecs.pdx.edu/~gerry/MATLAB/howTo/setMATLABpath.html#pathCommand
You can create your own structured function library and install/uninstall to the MATLAB path with this library template:
https://github.com/tiborsimon/MATLAB-Library-System-template
精彩评论