On Thu, Mar 18, 2010 at 3:02 PM, Alexander Barth <barth.alexan...@gmail.com> wrote: > you could do this like this: > > setfield(cdf{'var'},['NOTE_',int2str(N)],'This is fifth note') > > setfield allows you to add fields whose names are determined at > run-time to a struct. It also works for addition attributes in octcdf. > Another way could be the use of eval. But it is a good idea to avoid > eval if possible. > > Cheers, > Alex >
Actually, even setfield is sort of deprecated. You should be able to use a dynamic field reference directly: cdf{'var'}.(['NOTE_',int2str(N)]) = 'This is fifth note'; Note the extra parentheses, they're needed. >-- RNDr. Jaroslav Hajek, PhD computing expert & GNU Octave developer Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev