??? Either eval, evalin, assignin, an assignment in a script, load, or an
assignment at the debugger prompt has attempted to dynamically add the
variable "time0" to the workspace of one of:
o an anonymous function,
o a nested function, or
o a function that has a nested function.
If you are in the debugger and need a variable, say X, for temporary use
while debugging, make it a global:
K>> global X; X = ...
One way to avoid this error in the other cases is to pre-declare the variable
in the desired function. Specific suggestions to eliminate the error:
o eval, evalin, assignin --- for many reasons, it is best to avoid using
these altogether.
o assignment in a script --- a script can be turned into a function, with
argument- and result-passing often clarifying the code.
o load --- use the form of load that returns a struct result.
Dynamic addition of variables to workspaces associated with nested functions
is not allowed because the scoping rules for nested functions rely on the
presence or absence of variables in the text of the code. Permitting the
addition of variables at run-time would make the scoping rules more difficult
to explain and programs harder to understand. Similarly, dynamic addition of
variables to the workspace of an anonymous function is not allowed.
Partager