Convert each cell to numeric

2 次查看(过去 30 天)
Hi all,
I have this kind of code:
seq1 = [1,3,2,3,2,3,1,3];
seq2 = [3,3];
seq3 = [1,2,2,2,2,2,2,2];
seq4 = [1,2,1,1,2,2,1,2,2,1,2];
seqs = {seq1, seq2, seq3, seq4};
How can I read seq1, seq2, seq3, seq4 from seqs since hmmdecode(seqs,tr,e) only accepts numeric? is there a way to do a loop in seqs parameter?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-2-8
  12 个评论
Emmanuel
Emmanuel 2013-2-8
solved it by doing : hmmdecode(cell2mat(seqs(1,:)),tr,e);
thanks a lot!
Azzi Abdelmalek
Azzi Abdelmalek 2013-2-8
Ok try this, copy and past this code
clear
tr = [0.4,0.3,0.3;0.4,0.3,0.3;0.4,0.3,0.3;];
e = [0.4,0.3,0.3;0.3,0.4,0.3;0.3,0.3,0.4;];
seq1 = [1,3,2,3,2,3,1,3];
seq2 = [3,3];
seq3 = [1,2,2,2,2,2,2,2];
seq4 = [1,2,1,1,2,2,1,2,2,1,2];
seqs = {seq1, seq2, seq3, seq4};
out=cellfun(@(x) hmmdecode(x,tr,e) ,seqs,'un',0)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by