help-octave
[Top][All Lists]
Advanced

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

Re: Inferring required class for output arguments


From: Jaroslav Hajek
Subject: Re: Inferring required class for output arguments
Date: Thu, 12 Aug 2010 09:52:19 +0200

On Thu, Aug 12, 2010 at 9:46 AM, CdeMills <address@hidden> wrote:
>
> Hello,
>
> about my "dataframe" project: I made subsref returns a matrix if all the
> selected columns from the dataframe object are of type double. The purpose
> is to made the class as compatible as possible with all math operations. I
> added the ability to return a full dataframe as follows using this syntax:
> x(:, 2, 'dataframe')
> that is, there is a supplemental 'dim' specifying the output format. Is
> there some less intrusive way to detect from inside the routine the required
> output format ?
>

Since you can overload subsref virtually arbitrarily, you can make it, say,
x.dataframe(:, 2)

an alternative is to overload
x(:,2).dataframe
but then be sure to overload indexed numel properly (yes and you must
use Octave 3.3.51+).


-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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