|
From: Ata on 21 Jul 2010 05:40 Hello, I am reading from an excel sheet (with the command xlsread), 2 columns. One column includes the variable name, the other one contains the varible value. the variable name is read as a string, the variable value is a number. Now I would like to assign the variable value to the variable name. How can I do this.? Thanks for the suggestions and the help. Best Regards, Ata
From: Matt J on 21 Jul 2010 05:55 "Ata " <ata.douzdouzani(a)ch.abb.com> wrote in message <i26fdv$fnr$1(a)fred.mathworks.com>... > Hello, > I am reading from an excel sheet (with the command xlsread), 2 columns. One column includes the variable name, the other one contains the varible value. > the variable name is read as a string, the variable value is a number. > Now I would like to assign the variable value to the variable name. ========== No, it would be dangerous to do that. What you really want to do is assign the variable values to structure field names, like in the following for ii=1:N VariableName=xlsread(...); VariableValue=xlsread(...); S.(VariableName)=VariableValue; end
From: Joseph on 21 Jul 2010 13:43 "Ata " <ata.douzdouzani(a)ch.abb.com> wrote in message <i26f9r$7kp$1(a)fred.mathworks.com>... > Hello, > I am reading from an excel sheet (with the command xlsread), 2 columns. One column includes the variable name, the other one contains the varible value. > the variable name is read as a string, the variable value is a number. > Now I would like to assign the variable value to the variable name. > How can I do this.? > Thanks for the suggestions and the help. > Best Regards, > Ata try using cells for this.
From: someone on 21 Jul 2010 14:02 "Ata " <ata.douzdouzani(a)ch.abb.com> wrote in message <i26f9r$7kp$1(a)fred.mathworks.com>... > Hello, > I am reading from an excel sheet (with the command xlsread), 2 columns. One column includes the variable name, the other one contains the varible value. > the variable name is read as a string, the variable value is a number. > Now I would like to assign the variable value to the variable name. > How can I do this.? > Thanks for the suggestions and the help. > Best Regards, > Ata See the answer to Q4.6 of the MATLAB FAQ at: http://matlabwiki.mathworks.com/MATLAB_FAQ I'm sure you can adapt one of those solutions to your problem.
|
Pages: 1 Prev: help solve Next: assigning the variable value to the variable name |