Random Element

版本 1.0.0.0 (1.4 KB) 作者: Skynet
Returns elements randomly selected from any matrix.
2.3K 次下载
更新时间 2005/4/25

查看许可证

RANDELEMENT(ARRAY,N) returns a row of N elements, selected at random (and with replacement) from ARRAY.

[There probably is some toolbox function that does something very similar.]

EXAMPLES:

randelement([0:9],5)
may return [4 8 8 5 2]

randelement({'a' 'b' 'c' 'd' 'e' 'f'},2)
may return {'f' 'd'}

引用格式

Skynet (2024). Random Element (https://www.mathworks.com/matlabcentral/fileexchange/6644-random-element), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R14SP1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Made minor update to description and comments.