create an array
2 次查看(过去 30 天)
显示 更早的评论
I wonder how I can make an array (200,400) with values 0 to 7 which randomly distributed? I apperciate your help.
0 个评论
采纳的回答
更多回答(1 个)
Sean de Wolski
2011-6-30
szs = [20 20 30]; %sizes
vals = [1 0 2]; %values
C = cellfun(@(c,v)ones(c)*v,num2cell(szs),num2cell(vals),'uni',false);
M = blkdiag(C{:});
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!