Mercurial > hg > ltpda
diff m-toolbox/classes/@ltpda_data/ltpda_data.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@ltpda_data/ltpda_data.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,168 @@ +% LTPDA_DATA is the abstract base class for ltpda data objects. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: LTPDA_DATA is the base class for ltpda data objects. +% This is an abstract class. +% +% SUPERCLASSES: ltpda_nuo < ltpda_obj +% +% VERSION: $Id: ltpda_data.m,v 1.19 2011/03/25 15:33:52 mauro Exp $ +% +% SEE ALSO: data2D, ltpda_nuo, ltpda_obj, cdata +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +classdef (Hidden = true) ltpda_data < ltpda_nuo + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Property definition % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + %---------- Public (read/write) Properties ---------- + properties (GetAccess = public, SetAccess = public) + yunits = unit; % units of the y-axis + y = []; % data values of the y-axis + dy = []; % error on y values + end + + %---------- Protected read-only Properties ---------- + properties (GetAccess = public, SetAccess = protected) + end + + %---------- Private Properties ---------- + properties (GetAccess = protected, SetAccess = protected) + end + + %---------- Abstract Properties ---------- + properties (Abstract = true, SetAccess = protected) + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Check property setting % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods + %--- Yunits + function set.yunits(obj, val) + if ~ischar(val) && ~isa(val, 'unit') + error('### The value for the property ''yunits'' must be a unit-object or a string'); + end + if ischar(val) + obj.yunits = unit(val); + elseif isa(val, 'unit') + obj.yunits = val; + else + error('### The yunits value must be a unit or a string'); + end + end + %--- Y + function set.y(obj, val) + if ~isempty(val) + if ~(isnumeric(val) || islogical(val)) || ndims(val) ~= 2 + error('### The value for the property ''y'' must be a matric or a vector'); + end + end + if ~isempty(obj.y) && isvector(obj.y) && ((size(val,1) == 1 && size(obj.y,1) ~= 1) || (size(val,2) == 1 && size(obj.y,2) ~= 1)) + val = val.'; + end + obj.y = val; + + if ~isempty(findprop(obj,'x')) + sx = size(obj.x); + sy = size(obj.y); + if sx(1) == 1 && sy(1) ~= 1 + obj.x = obj.x.'; + end + if sx(2) == 1 && sy(2) ~= 1 + obj.x = obj.x.'; + end + end + end + %--- dY + function set.dy(obj, val) + if ~isempty(val) + if ~isnumeric(val) || ~(numel(val) == 0 || numel(val) == 1 || numel(val) == numel(obj.y)) + error('### The value for the property ''dy'' must have the length 0, 1 or the length of the y-values'); + end + end + obj.dy = val; + + sdy = size(obj.dy); + sy = size(obj.y); + if sdy(1) == 1 && sy(1) ~= 1 + obj.dy = obj.dy.'; + end + if sdy(2) == 1 && sy(2) ~= 1 + obj.dy = obj.dy.'; + end + end + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Constructor % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods + + function obj = ltpda_data(varargin) + end + + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Methods (public) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Methods (protected) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods (Access = protected) + varargout = fromStruct(varargin) + varargout = fromDom(varargin) + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Methods (private) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods (Access = private) + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Methods (static) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods (Static) + + function ii = getInfo(varargin) + ii = utils.helper.generic_getInfo(varargin{:}, 'ltpda_data'); + end + + function out = VEROUT() + out = '$Id: ltpda_data.m,v 1.19 2011/03/25 15:33:52 mauro Exp $'; + end + + function out = SETS() + out = {}; + end + + function out = getDefaultPlist() + out = []; + end + + end + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Methods (abstract) % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + methods (Abstract) + end + +end +