diff m-toolbox/test/gui/functions/gltpda_minus.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/test/gui/functions/gltpda_minus.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,45 @@
+function gltpda_minus(handles)
+
+% GLTPDA_MINUS for an array of analysis objects subtract A(2:end) from
+% A(1).
+% 
+% M Hewitson 15-02-07
+% 
+% $Id: gltpda_minus.m,v 1.1 2007/03/12 13:00:31 hewitson Exp $
+% 
+
+%% Get selected AOs
+% get AO array
+aos = getappdata(handles.main, 'aos');
+
+% Get selected objects
+selected = get(handles.aoList, 'Value');
+as = aos.objs(selected);
+
+%% Add these together using lincom
+
+if length(as) < 2
+  error('### Select at least two analysis objects.');
+elseif length(as) == 2
+  b = as(1)-as(2);
+else
+  pl = plist(param('coeffs', [1 -1*ones(1,length(as)-1)]));
+  b = ltpda_lincom(as, pl);
+end
+
+%% Add new ao to list 
+
+% Add to object array
+aos.objs  = [aos.objs b];
+aos.nobjs = aos.nobjs + length(b);
+
+% Set array
+setappdata(handles.main, 'aos', aos);
+
+% Update object list
+gltpda_setAOlist(handles);
+
+
+
+
+% END
\ No newline at end of file