Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Im trying to print a randomized vector with 20 columns for each row. How do I get to stop after it reaches the final value of the vector?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
for s=1:65
rando=randi([0,9],1,65);
fprintf('%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n', rando)
end
0 comentarios
Respuestas (2)
Massimo Zanetti
el 5 de Oct. de 2016
There is no need to write them each time. Use vectorization of fprintf command.
rando=randi([0,9],1,65);
fprintf('%d ',rando);
fprintf('\n');
1 comentario
Matthew Eicholtz
el 5 de Oct. de 2016
If I understand your code correctly, it appears that you want to create a 65x65 matrix of random integers in the range [0 9] that are printed to the command window. In that case, you don't need the for-loop or fprintf for this.
Try this:
rando = randi([0,9],65);
disp(rando);
1 comentario
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!