Borrar filtros
Borrar filtros

random pair data.

1 visualización (últimos 30 días)
reez all
reez all el 21 de Mayo de 2012
hi, thank you for helping me from my previous problem. i have other problem related to generate random pair between two array data.
for x = 1:5
y = randi([6,10],1);
fprintf('%d -> %d\n',x,y);
end
My problem is, the not all y data are used. i want all both x and y data is used. thank you for your help.

Respuesta aceptada

per isakson
per isakson el 21 de Mayo de 2012
"not all y are use". My guess is that you want something like:
y = 5 + randperm( 5, 5 );
for x = 1:5
fprintf('%d -> %d\n', x, y(x) );
end

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by