我怎么减去数量细胞?
3视图(30天)
显示旧的评论
接受的答案
1月
2021年5月30日
编辑:1月
2021年6月7日
Dice1 = (1/7 1/7 1/7 1/7 1/7 2/7);
Dice2 = (1/7 1/7 2/7 1/7 1/7 1/7);
印第安纳州= abs((1:长度(Dice1)) -(1:长度(Dice2)。”) + 1;
val = (Dice1 * Dice2。');
源= accumarray(印第安纳州(:),瓦尔(:))。”;
HuffTree = huffmandict(1:6,来源);
X = cell2mat (HuffTree (: 1)) - 1;
HuffTree (: 1) = num2cell (X);
更直接:
HuffTree (: 1) = cellfun (@ (x) {x - 1}, HuffTree (: 1))
但是为什么不从一开始就正确地创建树?
HuffTree = huffmandict(0:5,来源);