Cell contents reference from a non-cell array object.

function bnet = mk_chmm(N, Q, Y, discrete_obs, coupled, CPD)
if nargin < 2, Q = 2; end
if nargin < 3, Y = 1; end
if nargin < 4, discrete_obs = 0; end
if nargin < 5, coupled = 1; end
if nargin < 6, rnd = 1; else rnd = 0; end
ss = N*2;
hnodes = 1:N;
onodes = (1:N)+N;
intra = zeros(ss);
for i=1:N
intra(hnodes(i), onodes(i))=1;
end
inter = zeros(ss);
if coupled
for i=1:N
inter(i, max(i-1,1):min(i+1,N))=1;
end
else
inter(1:N, 1:N) = eye(N);
end
ns = [Q*ones(1,N) Y*ones(1,N)];
eclass1 = [hnodes onodes];
eclass2 = [hnodes+ss onodes];
if discrete_obs
dnodes = 1:ss;
else
dnodes = hnodes;
end
bnet = mk_dbn(intra, inter, ns, 'discrete', dnodes, 'eclass1', eclass1, 'eclass2', eclass2, ...
'observed', onodes);
if rnd
for i=hnodes(:)'
bnet.CPD{i} = tabular_CPD(bnet, i);
end
for i=onodes(:)'
if discrete_obs
bnet.CPD{i} = tabular_CPD(bnet, i);
else
bnet.CPD{i} = gaussian_CPD(bnet, i);
end
end
for i=hnodes(:)'+ss
bnet.CPD{i} = tabular_CPD(bnet, i);
end
else
for i=hnodes(:)'
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
end
for i=onodes(:)'
if discrete_obs
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
else
bnet.CPD{i} = gaussian_CPD(bnet, i, CPD{i}.mean, CPD{i}.cov);
end
end
for i=hnodes(:)'+ss
bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);
end
end

5 个评论

I am getting error
Cell contents reference from a non-cell array object
Error in mk_chmm (line 89) bnet.CPD{i} = tabular_CPD(bnet, i, CPD{i}.CPT);;
Please tell me how to solve this problem.
This seems to have something to do with Dynamic Bayesian Networks http://www.cs.ubc.ca/~murphyk/Software/BNT/usage_dbn.html but I am not sure which software package you are using.
i use FullBNT but i still have this problem.
bnet itself might not be a struct or object. For example bnet might be empty.

请先登录,再进行评论。

回答(0 个)

类别

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by