How can I randomly pick a row (A) from a matrix give the same value from array (B)?
Mostrar comentarios más antiguos
I have a coordinate matrix (A) which is nx2, and an index array (B) which is nx1. for example:
A=[1,2; 0,3; 3,8; 6,5; ....; 3,7];
B=[1;2;2;3;1;1;3;...3; 2];
I want to randomly pick a row from A which has the same value group from B. for example:
G1=random a row [Ax1, Ay1; such that B=1];
G2=random a row [Ax2, Ay2; such that B=2];
G3=random a row [Ax3, Ay3; such that B=3]; and so on
G1,G2 ... are 1x2 corrdinate arrays.
Is there a command or simple algorithm to do the reandom assigmenet
1 comentario
Zhi Yuan Liao
el 13 de Mzo. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!