显示 更早的评论
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?
采纳的回答
seqs{1}
seqs{2}
12 个评论
but i need to run hmmdecode(seqs,tr,e) only once not twice.
Azzi Abdelmalek
2013-2-8
编辑:Azzi Abdelmalek
2013-2-8
Maybe you can use cellfun,what are tr and e?
cellfun(@(x) hmmdecode(x,tr,e) ,seqs,'un',0)
pStates = hmmdecode(cellfun(seqs),tr,e);
I think it does not give me what I need. It is used for getting mean, converience etc..
cellfun(@(x) hmmdecode(x,tr,e) ,seqs,'un',0)
i got this error:
Error using cellfun Input #3 expected to be a cell array, was double instead.
Check this (but you have to introduce tr and e)
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)
same error
Azzi Abdelmalek
2013-2-8
编辑:Azzi Abdelmalek
2013-2-8
What are tr and e?
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;];
solved it by doing : hmmdecode(cell2mat(seqs(1,:)),tr,e);
thanks a lot!
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
