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

1 visualización (últimos 30 días)
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.

Respuestas (2)

Jan
Jan el 8 de Feb. de 2013
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
  2 comentarios
Emmanuel
Emmanuel el 8 de Feb. de 2013
I know what's the problem. Seqs is a cell and hmmdecode only accepts numeric. Is there a way how to make a loop in seqs to read seq1 and seq2?

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 8 de Feb. de 2013
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?

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by