help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error with dim_vector


From: Justin Bare
Subject: Re: Error with dim_vector
Date: Thu, 13 Aug 2009 12:32:02 -0400 (EDT)
User-agent: SquirrelMail/1.4.8-4.fc5

I was originally just doing:

data(v) = Cell((octave_value)var);

but this gives me a compiler error that says "error: conversion from ‘int’
to non-scalar type ‘dim_vector’ requested" which is why i changed it to
the dim_vector.
In that case, could you tell me how to get rid of this error with the
normal indexing operator?


> On 13-Aug-2009, Justin Bare wrote:
>
> | The following C++ code gives me the runtime error "undefined symbol:
> | _Z4data10dim_vector" at the line "data(dim_vector(v)) =
> | Cell((octave_value)var);" Any ideas?
> |
> |     int numVars = myData.arrayVars.size();
> |
> |     string_vector names;
> |     names.resize(numVars);
> |     for(int i = 0; i < numVars; i++){
> |       names[i] = myData.varNames[i];
> |
> |     }
> |
> |
> |     int numTimeSteps = myData.arrayVars[names[0]].size();
> |
> |     Cell data(dim_vector(numVars));
> |
> |
> |     for(int v = 0; v < numVars; v++){
> |       int dataLength = myData.arrayVars[names[v]][0].size();
> |
> |       NDArray var = NDArray(dim_vector(numTimeSteps, dataLength));
> |       for (int t = 0; t < numTimeSteps; t++){
> |         for(int i = 0; i < dataLength; i++){
> |           var(t, i) = myData.arrayVars[names[v]][t][i];
> |
> |         }
> |       }
> |       data(dim_vector(v)) = Cell((octave_value)var);
> |     }
>
> The expression dim_vector(v) constructs a dim_vector object from v.
> Octave's dim_vector objects are for defining dimensions, not indexing.
>
> jwe
>


-- 

Justin Bare
Robotic Research, LLC.
814 West Diamond Ave, Suite 301
Gaithersburg, MD 20878
240-631-0008 Ext 246


reply via email to

[Prev in Thread] Current Thread [Next in Thread]