Pseudorandom character matrix generation
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Abhraneil
el 29 de Sept. de 2022
Comentada: Rik
el 30 de Sept. de 2022
Generate a 10x10 matrix with the letters 'b', 'd', 'p', 'q' in randomized order. Every refresh should produce a new randomized matrix.
This is to simulate the bdpq test. Should be a pretty simple task, but seems to be otherwise!
0 comentarios
Respuesta aceptada
Rik
el 29 de Sept. de 2022
If you want a 10x10 char array, you can also use indexing:
source = 'bdpq';
Array = source(randi(end,[10 10]))
3 comentarios
Rik
el 30 de Sept. de 2022
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.
Más respuestas (1)
KSSV
el 29 de Sept. de 2022
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 comentarios
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!