head	1.2;
access;
symbols;
locks
	jonh:1.2; strict;
comment	@// @;


1.2
date	2000.04.08.18.22.18;	author jonh;	state Exp;
branches;
next	1.1;

1.1
date	2000.03.24.14.08.25;	author jonh;	state Exp;
branches;
next	;


desc
@null
@


1.2
log
@*** empty log message ***
@
text
@function outs = select_experiment(ins, key, op, value)
% select a subexperiment from ins where key==value

% can't figure out how to get find() to act vectorized over
% cell array. Grr.
selecti = [];
keymap = getfield(ins,key);
if (isequal(op,'equal')),
	for i=1:length(keymap),
		if (isequal(keymap(i),cellstr(value))),
			selecti(i) =1;
		end
	end
elseif (isequal(op,'lt')),
	selecti = keymap<value;
end
findi = find(selecti);

outs = struct('type','experiment');

fn = fieldnames(ins);
for i=1:length(fn),
	field = char(fn(i));
	array = getfield(ins,field);
	if (size(array,1)>1),
		outs = setfield(outs, field, array(findi,:));
	end
end
@


1.1
log
@null
@
text
@d26 1
a26 1
		outs = setfield(outs, field, array(findi));
@
