Daniel@0: Cell arrays are a little tricky in Matlab. Daniel@0: Consider this example. Daniel@0: Daniel@0: C=num2cell(rand(2,3)) Daniel@0: C = Daniel@0: [0.4565] [0.8214] [0.6154] Daniel@0: [0.0185] [0.4447] [0.7919] Daniel@0: Daniel@0: C{1,2} % this is the contents of this cell (could be a vector or a string) Daniel@0: ans = Daniel@0: 0.8214 Daniel@0: Daniel@0: C{1:2,2} % this is the contents of these cells - returns multiple Daniel@0: answers! Daniel@0: ans = Daniel@0: 0.8214 Daniel@0: ans = Daniel@0: 0.4447 Daniel@0: Daniel@0: A = C(1:2,2) % this is a slice of the cell array Daniel@0: ans = Daniel@0: [0.8214] Daniel@0: [0.4447] Daniel@0: Daniel@0: A{1} % A is itself a cell array Daniel@0: ans = Daniel@0: 0.8214 Daniel@0: Daniel@0: Daniel@0: Daniel@0: >> C(1:2,2)=0 % can't assign a scalar to a cell array Daniel@0: C(1:2,2)=0 Daniel@0: ??? Conversion to cell from double is not possible. Daniel@0: Daniel@0: Daniel@0: >> C(1:2,2)={0;0} % can assign a cell array to a cell array Daniel@0: C(1:2,2)={0;0} Daniel@0: C = Daniel@0: [0.4565] [0] [0.6154] Daniel@0: [0.0185] [0] [0.7919] Daniel@0: Daniel@0: Daniel@0: BTW, I use cell arrays for evidence for 2 reasons: Daniel@0: Daniel@0: 1. [] indicates missing values Daniel@0: 2. it can easily represent vector-valued nodes Daniel@0: Daniel@0: The following example makes this clear Daniel@0: Daniel@0: C{1,1} = [] Daniel@0: C{2,1} = rand(3,1) Daniel@0: Daniel@0: C = Daniel@0: [] [0] [0.6154] Daniel@0: [3x1 double] [0] [0.7919] Daniel@0: Daniel@0: Daniel@0: Hope this helps, Daniel@0: Kevin