[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: create variable with name from string?
From: |
John W. Eaton |
Subject: |
Re: create variable with name from string? |
Date: |
Sun, 30 Mar 2008 10:08:53 -0400 |
On 30-Mar-2008, Stefan Pofahl wrote:
| eval (sprintf ([nameofvariable, "= ", num2str(numberoffruits, "%i")]));
Since you're using sprintf anyway, you can simplify this to be
eval (sprintf ("nameofvariable = %d", numberoffruits"));
but I think it is generally best to avoid generating new variables
with eval.
jwe