How do I get around this limitation, I need to turn my scripts into functions that take no arguments (if I need variables from the global namespace, I either explicitly pass them into functions, or use "evalin" to capture them.)
Then you can define all the additional functions that you need in the "script". This is a hack, but I found it powerful enough in cases where I need several non-trivial functions.
EDIT: Here's a simplified example. All this can be in one file.
function [] = myScriptAsAFunction() img = randn(200); img = smooth(img); figure(1); imagesc(img); axis image; colorbar; end function simg = smooth(img) simg = img / 5; end
John 06 Feb 2018-12-12T00: 00Z
source share