[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 13:58:56 +0100 |
User-agent: |
Mutt/1.4.1i |
What about something like
#include <octave/oct.h>
#include <octave/Cell.h>
DEFUN_DLD (myvol, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} address@hidden =} myvol (@var{n})\n\
\n\
Create @var{n} by 1 cell array of matrices\n\
@end deftypefn\n")
{
octave_value retval;
int n = args(0).nint_value ();
Cell c (n,1);
// Just fill with empty matrices for this test
for (int i = 0; i <n; i++)
c (i) = octave_value (Matrix (2, 2, 0));
retval = c;
return retval;
}
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
>
> 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