comparison extra/ncArray/inst/@DerivedArray/DerivedArray.m @ 12680:1a9c41feaf2b octave-forge

add derived Array class
author abarth93
date Mon, 24 Aug 2015 08:49:21 +0000
parents
children
comparison
equal deleted inserted replaced
12679:a74726ba86d1 12680:1a9c41feaf2b
1 % Create a derived array
2 %
3 % V = DerivedArray(function,{params})
4 %
5 % Example:
6 % Temp_in_C = DerivedArray(@(t) t-273.15,{Temp_in_K})
7 %
8 % see also ncArray
9 % Web: http://modb.oce.ulg.ac.be/mediawiki/index.php/ncArray
10
11
12 function retval = DerivedArray(fun,params)
13
14 self.fun = fun;
15 self.params = params;
16
17 retval = class(self,'DerivedArray',BaseArray(size(params{1})));
18
19
20
21
22
23
24 % Copyright (C) 2015 Alexander Barth <barth.alexander@gmail.com>
25 %
26 % This program is free software; you can redistribute it and/or modify
27 % it under the terms of the GNU General Public License as published by
28 % the Free Software Foundation; either version 2 of the License, or
29 % (at your option) any later version.
30 %
31 % This program is distributed in the hope that it will be useful,
32 % but WITHOUT ANY WARRANTY; without even the implied warranty of
33 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 % GNU General Public License for more details.
35 %
36 % You should have received a copy of the GNU General Public License
37 % along with this program; If not, see <http://www.gnu.org/licenses/>.
38