Let's say I have some function foothat is used in a standalone application (i.e. compiled into an executable c mcc -m), which has an important intermediate result bar. I usually donβt need this intermediate result after the function completes, and therefore it is not a return value. However, for development and debugging purposes, itβs useful to be able to make this intermediate result available, which I can use assigninto put the intermediate result in some debugging workspace.
Now the problem is that it is assigninnot possible in offline compilation, but mccwill complain about an error if there is one in the code assignin. What I would like to do is enable assigninonly when the code is launched interactively, and not when compiled as a separate application. In addition, this will speed up the process, since I do not need an intermediate result in a stand-alone application, and thus it can simultaneously and / or memory without having to assignin in a stand-alone application. In any other programming environment, you could call this compilation in debug and release mode.
In the pseudo malaby:
function res = foo()
bar = some complicated formula
if ~standalone
assignin('debug', 'foo_bar', bar)
end
res = some complicated formula involving bar
, , if ~standalone, -, , , , , , mcc , .
, , assignin. , , .
Matlab, , ? , , .