[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ndarray slice in oct file
From: |
David Bateman |
Subject: |
Re: ndarray slice in oct file |
Date: |
Mon, 16 Jul 2007 09:41:12 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Daniel Oberhoff wrote:
> Hi,
>
> Can anyone tell me how to properly to slicing in oct-files?
> Unfortunately the doxygen seems to be rather, well, undocumented :).
> Right now I need a slice of an nd array to go into a matrix slice (or
> an ndarray slice, doesn't matter), but matrix to matrix slicing would
> be nice too. So stuff like:
>
> a(1:3,4:5) = b(2:4,1:2,3);
>
> but in an oct-file.
>
> Daniel
>
>
There are no slicing methods in the NDArray classes, though maybe one
should be added. So you either have to do it by hand or convert the
above m-file code to an oct-file directly working on the octave_values..
This will be slow however. That is something like
Array<idx_vector> idx_vec (3);
NDArray b = args(0).array_value ();
idx_vec(0) = idx_vector (Range (2., 4.);
idx_vec(1) = idx_vector (Range (1., 2.);
idx_vec(2) = idx_vector (3.);
NDArray a = b.index (idx_vec);
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary