From: Susan on 12 Jan 2010 16:36 The documentation describes this limitation to evalin: Limitation evalin cannot be used recursively to evaluate an expression. For example, a sequence of the form evalin('caller', 'evalin(''caller'', ''x'')') doesn't work. Does anyone have a workaround for this? Sometimes I'd really like to reach up two levels instead of just one. Thanks, Susan
From: Bruno Luong on 12 Jan 2010 16:50 "Susan " <foowidget(a)gmail.com> wrote in message <hiiq0f$ipu$1(a)fred.mathworks.com>... > The documentation describes this limitation to evalin: > > Limitation > > evalin cannot be used recursively to evaluate an expression. For example, a sequence of the form evalin('caller', 'evalin(''caller'', ''x'')') doesn't work. > Here is a tip: instead of using eval to reach two levels up, pass x as input arguments to reach two levels down. Bruno
From: Matt Fig on 12 Jan 2010 16:52 Can you give a realistic example of what you are trying to accomplish by this syntax?
From: Matt J on 12 Jan 2010 16:54 "Susan " <foowidget(a)gmail.com> wrote in message <hiiq0f$ipu$1(a)fred.mathworks.com>... > The documentation describes this limitation to evalin: > > Limitation > > evalin cannot be used recursively to evaluate an expression. For example, a sequence of the form evalin('caller', 'evalin(''caller'', ''x'')') doesn't work. > > Does anyone have a workaround for this? Sometimes I'd really like to reach up two levels instead of just one. ================== You should probably be using nested functions function aout =A(ain) x=[]; %initialize x function bout =B(bin) function cout =C(cin) x=2; %function A() can see this end end end
From: Matt Fig on 12 Jan 2010 17:38 Maybe I missed the point of the limitation, but copying and pasting from the documentation, gives >> clear all >> x = 3; >> evalin('caller','evalin(''caller'', ''x'')') % Copied from the doc. x = 3 >> z = evalin('caller','evalin(''caller'', ''x'')') z = 3 >> evalin('caller','y = evalin(''caller'', ''x'')') y = 3 >> who Your variables are: x y z
|
Next
|
Last
Pages: 1 2 3 4 Prev: Hydraulic Pump transfer function. Next: using rough sets for noise filtering |