samplewithr.m

来自「基于matlab写的对人体的分割程序」· M 代码 · 共 10 行

M
10
字号
function Y = sampleWithR(weights,K)%Y = sampleWithR(weights,K)%Generates K samples from the discrete distribution specified by weights%O(K) %Need to handle border effectscdf = cumsum(weights);Y = histc(rand(K,1)*cdf(end),[0; cdf]);Y = [Y(1:end-2); Y(end-1)+Y(end)];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?