randsample([0 1],1,true,[1 - p p]) ..... with p as a vector?
1 次查看(过去 30 天)
显示 更早的评论
I have the following code that generates a 0 or a 1 depending on the probability p:
randsample([0 1],1,true,[1 - p p])
But suppose my probability was taken from a vector of other probabilities. Is it possible to ammend my code to handle all probabilities at once, rather than looping through the vector for each probability?
2 个评论
Rik
2018-11-29
I don't understand your question, nor do I have the toolbox for this function, so I can't play around with it for you.
回答(2 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Biomedical Imaging 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!