octave 3.2.0 parser

John W. Eaton jwe at octave.org
Mon Jun 8 17:18:42 CDT 2009


On  8-Jun-2009, Alexander Barth wrote:

| On Mon, Jun 8, 2009 at 8:24 PM, John W. Eaton<jwe at octave.org> wrote:
| > On  8-Jun-2009, Alexander Barth wrote:
| >
| > | The matlab netcdf toolbox in octave uses expressions like these:
| > |
| > |  f{'myVariable', 1}(i, j, ...) = myVariableData
| > | (see http://ecco2.jpl.nasa.gov/data1/matlab/netcdf_toolbox/netcdf/@netcdf/netcdf.m).
| > |
| > | With octcdf I implemented this functionality in octave. However since
| > | octave 3.2.0, such expressions trigger an error:
| > |
| > | octave:1>  nc{'autoscale_var',1}(:) = var;
| > | error: a cs-list cannot be further indexed
| > | error: evaluating argument list element number 1
| > |
| > | It worked previously in octave 3.0.5.
| >
| > What are the values of the variables NC and VAR?
| >
| > jwe
| >
| 
| nc is ncfile. This object is created in octcdf
| (http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/octcdf/src/ov-ncfile.h?revision=4812&view=markup)
| and var is just a matrix. A complete example (which requires octcdf)
| would be:
| 
| nc = netcdf('test.nc','c'); % creates a netcdf file test.nc
| 
| nc('time') = 5;  % defines dimension time
| nc('space') = 3; % defines dimension space
| 
| var = rand(5,3);
| 
| nc{'autoscale_var'} =  ncdouble('time','space');  % defines a variable
| depending on time and space
| nc{'autoscale_var'}.add_offset = 1; % variable will be stored with an
| offset of 1
| nc{'autoscale_var'}.scale_factor = .1; % and scaled by a factor of .1
| nc{'autoscale_var',1}(:) = var; % write variable to netcdf file with
| autoscaling enabled
| 
| close(nc) % close netcdf file
| 
| I have this problem with octave 3.2.0 compiled with --enable-64, but I
| don't think that this option has something to do with this (or not?)

I don't understand precisely what it is you are trying to do, but
apparently in your expression

  nc{'autoscale_var',1}(:) = var;

the first part

  nc{'autoscale_var',1}

is creating a comma-separated list, and you can't index a
comma-separated list now.  A comma-separated list is just a group of
objects, not a single object.  So indexing it doesn't make sense.

jwe



More information about the Bug-octave mailing list