HMM with 41 states error occurs

1 次查看(过去 30 天)
Emmanuel
Emmanuel 2013-5-6
I am getting this error when I added the 41th state into my HMM model:
Attempted to access tr(39,0); index must be a positive integer or logical.
How can I solve this problem please?

回答(2 个)

Sean de Wolski
Sean de Wolski 2013-5-6
编辑:Sean de Wolski 2013-5-6
MATLAB uses 1-based indexing not zero. In order to reference the 39th element in the first column:
tr(39,1)
Please post all of the code used to get tr is this does not answer your question.

Emmanuel
Emmanuel 2013-5-6
clear res
fid = fopen('pokertjba.txt');
line1 = fgetl(fid);
res{1}=line1;
while ischar(line1)
line1 = fgetl(fid);
res{end+1} =line1;
end
fclose(fid);
res(end)=[];
games=cellfun(@str2num,res,'un',0);
gamess = cell2mat(games);
% [tr, e] = hmmtrain(games,estTR,estE);
[tr,e] = hmmestimate(gamess,gamess)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by