[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: constructing variable names from strings
From: |
Ben Abbott |
Subject: |
Re: constructing variable names from strings |
Date: |
Thu, 18 Jun 2015 13:40:42 -0400 |
> On Jun 18, 2015, at 10:54 AM, D Peter Siddons <address@hidden> wrote:
>
> Is it possible to build a variable name from strings? I'd like to
> batch-process a lot of data. The data is held in directories identified by
> the dataset number, with Octave variable names built (by a C program) from
> the dataset number. I then need to loop through these directories to perform
> more processing, loading the data and saving processed data based on the
> dataset ID. I need to have the variables uniquely identified with the dataset
> because I need to have multiple datasets in memory simultaneously.
Could you use a structure array with fields?
data(datasetnumber).(variablename{1}) = …
data(datasetnumber).(variablename{2}) = …
Where “datasetnumber” is the integer index of the structure, and “variablename”
is a cell-string of the variable names.
Ben