[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unidentified subject!
From: |
Joao Cardoso |
Subject: |
Re: Unidentified subject! |
Date: |
Tue, 11 Apr 2000 17:43:00 +0100 |
Hendrik Naumann wrote:
>
> Hi Octave users
>
> I have the a structure
>
> a.data.d1
> a.data.d2
> a.data.d3
> a.data.d4
> ...
>
> I want to write a function caltulatetes somthing out of the datasets
> and stores in new structure
>
> a.result.d1
> a.result.d2
> a.result.d3
> a.result.d4
> ...
>
> function diff_first_struct(struct)
> for [matrix,key] = struct.data
> struct.result.key = diff_first(matrix);
> endfor
> endfunction
>
> But there are two problems. That would need call by reference and a
> operator that makes it possible to defines the name
> struct1.result.key by avaluating key like struct.result.$(key), or
> something like that.
`key', in your example, is a string. You can do
eval(sprintf("struct.result.%s=diff_first(matrix)", key))
ugly...
or you can use structures of lists--on Octave 2.1.xx only
>
> what possibilities do you see expect
>
> a.result.d1 = func(a.data.d1);
> a.result.d2 = func(a.data.d2);
> a.result.d3 = func(a.data.d3);
> a.result.d4 = func(a.data.d4);
>
> Thanks Hendrik Naumann
>
> -----------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
> How to fund new projects: http://www.che.wisc.edu/octave/funding.html
> Subscription information: http://www.che.wisc.edu/octave/archive.html
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------