Mercurial > hg > ltpda
view m-toolbox/classes/@ssm/blockMatPrune.m @ 22:b11e88004fca database-connection-manager
Update collection.fromRepository
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% blockMatPRUNE selects lines and columns of a block defined matrices stored in a cell array %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: cell_select selects lines and columns of a block defined % matrices stored in a cell array % % CALL: [cell2] = ssm.cell_array_prune(cell1,rowindex,colindex) % % INPUTS: % cell1 - block defined matrix in cell array % rowsizes - vector giving block height % colsizes - vector giving block width % % OUTPUTS: % cell2 - cell array of matrices representing a matrix by blocs. % blocs may be empty % % NOTE : function is private to the ssm class % % VERSION: '$Id: blockMatPrune.m,v 1.6 2011/04/08 08:56:22 hewitson Exp $' % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = blockMatPrune(varargin) cell_in = varargin{1}; rowindex = varargin{2}; colindex = varargin{3}; Nrows = numel(rowindex); Ncols = numel(colindex); %% selecting content cell_out = cell(Nrows, Ncols); for ii=1:Nrows for jj=1:Ncols if ~isequal(cell_in{ii,jj}, []) || min(ii, Ncols)==min(jj, Nrows) % if we have a non-empty cell or we are on the extended diagonal cell_out{ii,jj} = cell_in{ii,jj}(rowindex{ii},colindex{jj}); end end end varargout = {cell_out}; end