|
"Wayne King" <wmkingty@gmail.com> wrote in message <isiro1$p7i$1@newscl01ah.mathworks.com>...
> "Aron Sceidt" <sigarru87@gmail.com> wrote in message <isird8$o81$1@newscl01ah.mathworks.com>...
> > "Wayne King" <wmkingty@gmail.com> wrote in message <isiqeo$l34$1@newscl01ah.mathworks.com>...
> > > "Aron Sceidt" <sigarru87@gmail.com> wrote in message <isilsg$4qv$1@newscl01ah.mathworks.com>...
> > > > a = 'length';
> > > > mystring = 'abc';
> > > > x = str2func(a);
> > > > rvar = 'mystring';
> > > > x(rvar)
> > > >
> > > > Is it possible that in someway x(rvar) returns 3 instead of 8?
> > > >
> > > > I know why is this happening but I want the last line to reference a variable with the name of what rvar stores. This would be declared already.
> > > >
> > > > Help?
> > >
> > > Hi, Why not just
> > >
> > > a = 'length';
> > > rvar = 'abc';
> > > x = str2func(a);
> > > x(rvar)
> > >
> > > Wayne
> >
> > I wish it was that simple hehe.. The thing is that I'm reading the variable rvar from a database... I just gave this as an example here
>
> But you're still reading it to the workspace as a string?
yes, but the code is different from the one i gave here... basically my question here is how to achieve 3 without changing the first 4 lines?
|