Fill matrix with random letters and numbers

1 visualización (últimos 30 días)
Frank
Frank el 10 de Ag. de 2011
In MATLAB,I need to create a 36 by 20 matrix and then fill column by column, with a randomized selection from the characters A through Z and 0 through 9.
So each column will have the same characters but in a randomized order.
Your hints and suggestions are welcome.
Thank you.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 10 de Ag. de 2011
A9=['A':'Z' '0':'9';];
Data=zeros(length(A9),20);
for k=1:size(Data,2)
Data(:,k)=randperm(length(A9));
end
Data=A9(Data)
  17 comentarios
Paulo Silva
Paulo Silva el 12 de Ag. de 2011
No problem Frank, just in case you don't need the excel file you can just save the variable Data to a mat file
save('MyData','Data')
and load it when you need to use it
load('MyData')
the variable appears again on your workspace with the same name and contents.
Frank
Frank el 12 de Ag. de 2011
Thank you again!!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by