octave-maintainers
[Top][All Lists]
Advanced

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

Re: Nd cell array


From: David Bateman
Subject: Re: Nd cell array
Date: Thu, 4 Mar 2004 14:12:52 +0100
User-agent: Mutt/1.4.1i

According to Philipp.Batchelor <address@hidden> (on 03/04/04):
> Hi,
> 
> sorry, trying to reformulate, I posted to help-octave, maybe it is more 
> for this list.
> 
> I am trying to read 3d volume data using another c++ library (vtk), and 
> load it into Octave, I thought I would return a cell array,
> i.e. in an *.m file, the syntax would correspond to

Rereading your problem, why not just return a 3d arrays, which you can do
in versions of octave 2.1.51 and later..... Not, to completely rewrite
my previous example, but something like

   dim_vector dv; // Size of 3d array 
   NDArray m;

   // Probe size of array
   dv.resize (3);
   dv(0) = ...; dv(1) = ...; dv(2) = ...;

   // Resize array
   m.resize (dv);

   for (int i=0; i < dv(0); i++)
     for (int j=0; j < dv(1); j++)
       for (int k=0; k < dv(2); k++)
         m (i, j, k) = ...;

   retval = m;

> 
> for slice = 1:n
>   volume{slice} = ...% some 2d array, say a Matrix
>   ...etc
> 
> but I can't work out what the syntax in C++ would be.
> How would I create an array with say 128 elements which are each a 2D 
> Matrix, and assign to elements, (and return this cell array) in a 
> dynamically loadable C++ file?
> 
> Ph. Batchelor

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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