Azzera filtri
Azzera filtri

How do I randomly select ax,ay, az values and assign it to a node?

1 visualizzazione (ultimi 30 giorni)
I am trying to set up a simulation and wanted to know how to do the following:
I have a matrix of values and a max of N nodes (N=3 in this case). For each node, I want to randomly assign one of the rows below such that all three nodes get assigned a different row.
A = [1 2 3; 4 5 6; 7 8 9]
So for e.g: in one simulation node1 -> N1 may have the A values of [1 2 3]; N2 may have [4 5 6] and N3 may have [7 8 9].
When I rerun it => N1 may have the A value of [4 5 6], N2 may have [7 8 9] and N3 may have [1 2 3].
If I can get some help regarding this, it would super helpful.

Risposta accettata

Steven Lord
Steven Lord il 1 Set 2020
The randperm function will be of use to you.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by