view m-toolbox/classes/+utils/@helper/setoutputs.m @ 39:11e3ed9d2115
database-connection-manager
Implement databases listing in database connection dialog
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % SETOUTPUTS sets the output cell-array for LTPDA methods.
+ − %
+ − % CALL
+ − % out = utils.helper.setoutputs(nout, objs)
+ − %
+ − % Given the number of output arguments and the array of output objects,
+ − % this method does:
+ − %
+ − % 1) if nout == 1, returns a single cell array of objects
+ − % 2) if nout == numel(objs), returns a cell-array with one object per cell
+ − % 3) all other cases, it throws an error
+ − %
+ − % This is intended for use in LTPDA methods like this:
+ − %
+ − % varargout = utils.helper.setoutputs(nargout, objs)
+ − %
+ − % M Hewitson 01-04-11
+ − %
+ − % VERSION: $Id: setoutputs.m,v 1.3 2011/04/11 19:49:51 ingo Exp $
+ − %
+ −
+ − function out = setoutputs(nout, bs)
+ −
+ − if nout == 0
+ − out = {bs};
+ − elseif nout == 1
+ − out = {bs};
+ − elseif nout == numel(bs)
+ − out = cell(size(bs));
+ − for ii = 1:numel(bs)
+ − out{ii} = bs(ii);
+ − end
+ − else
+ − error('Mismatch between number of ouput objects and output arguments');
+ − end
+ −
+ − end