comparison m-toolbox/classes/+utils/@helper/jArrayList2CellArray.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % JARRAYLIST2CELLARRAY Converts a java ArrayList into a MATLAB cell array.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: JARRAYLIST2CELLARRAY Converts a java ArrayList into a MATLAB
5 % cell array.
6 %
7 % CALL: cellArray = jArrayList2CellArray(jArrayList)
8 %
9 % VERSION: $Id: jArrayList2CellArray.m,v 1.1 2010/08/18 09:19:06 ingo Exp $
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 function c = jArrayList2CellArray(jArrayList)
13
14 if isjava(jArrayList) && isa(jArrayList, 'java.util.ArrayList')
15
16 c = {};
17 for ii=0:jArrayList.size()-1
18 c = [c {jArrayList.get(ii)}];
19 end
20 else
21 error('### The input is not a java ArrayList but from class %s', class(jArrayList));
22 end
23
24 end