Subscript indices must either be real positive integers or logicals and other error.

1 次查看(过去 30 天)
Hi,
I want to read through both matrixes seq and seq2 but gives me two errors. Here is the code:
tr = [0.95,0.05;
0.10,0.90];
e = [1/6, 1/6, 1/6, 1/6, 1/6, 1/6;
1/10, 1/10, 1/10, 1/10, 1/10, 1/2;];
seq1 = hmmgenerate(100,tr,e);
seq2 = hmmgenerate(200,tr,e);
seqs = {seq1,seq2};
[estTR, estE] = hmmtrain(seqs,tr,e);
pStates = hmmdecode(seqs,tr,e);
Error using hmmdecode (line 96)
The sequence must be numeric, or you must specify the symbols used in the sequence.
pStates = hmmdecode(seqs(i,:),tr,e);
Subscript indices must either be real positive integers or logicals.

回答(2 个)

Jan
Jan 2013-2-8
It seems like you want to call the function hmmdecode(), but you have created a variable with the same name. Check this by:
dbstop if error
Then start the code and wait until Matlab stops. Then type in the command line:
which hmmdecode -all

Walter Roberson
Walter Roberson 2013-2-8
I see that you have copied the example right from the documentation. We need to ask, though, which MATLAB version you are using, as you might be using an earlier version that does not support that example as-is.
Have you tried passing in a Symbols name/value pair?

类别

Help CenterFile Exchange 中查找有关 Entering Commands 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by