Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: matlab converting a string to variable name and assign a string to it
Replies: 2   Last Post: Aug 13, 2013 2:27 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,660
Registered: 2/7/05
Re: matlab converting a string to variable name and assign a string
to it

Posted: Aug 11, 2013 5:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 8/11/2013 3:45 AM, shaho wrote:
> Hi , I have a problem ,I really appreciate if someone can help
> I tried to write a code to do this this assignment automatically
> "tree.Rightkids=SE1"
> here tree.Rightkids is a variable and SE1 is string .
> this is my code
> string1 =['tree.' ,'Rightkids']
> str ='A';
> eval(sprintf('%s=%c',string1,str))
> but I got the following error
>
> Error using eval
> Undefined function or variable 'A'.
> if anyone know How can I do this assignmnet.
>


try

A=someNumber

then add your convoluted code after that so that A will
have some value.

--Nasser




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.