Pseudorandom character matrix generation
2 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Rik
2022-9-29
If you want a 10x10 char array, you can also use indexing:
source = 'bdpq';
Array = source(randi(end,[10 10]))
3 个评论
Rik
2022-9-30
I can't say I understand what you want to do, so I don't have any suggestions. Your steps don't seem very complicated, so I don't expect to have a much better solution.
更多回答(1 个)
KSSV
2022-9-29
s = {'b', 'd', 'p', 'q' } ;
S = cell(10) ;
for i = 1:10
for j = 1:10
t = s(randperm(4,4)) ;
S{i,j} = [t{:}] ;
end
end
S
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!