could anyone help me how to run the line without using randsample

could anyone help me how to run the line without using randsample rows=unused_rows(randsample(length(unused_rows),N_UE_rows))

回答 (2 件)

Image Analyst
Image Analyst 2018 年 4 月 13 日

0 投票

Try randperm().

2 件のコメント

Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 16 日
編集済み: Walter Roberson 2018 年 4 月 16 日
in my code the total number of rows is 4.
Lets say (1,2,3,4). I am forming 2 groups and I am running the code with respect to 4 iterations. For each iterations the number of rows displayed keeps on changing and i am getting the following result.
iteration-1
rows = 3 4
rows = 1 2
iteration-2
rows =4 1
rows =3 2
iteration-3
rows =2 3
rows =4 1
iteration-4
rows =1 2
rows =3 4
But what i actually is need the number of rows need to be fixed for every iterations. Could you please help me on this.
Walter Roberson
Walter Roberson 2018 年 4 月 16 日
In the output you show, the number of rows is the same each time, 2 rows each time.
Walter Roberson
Walter Roberson 2018 年 4 月 16 日

0 投票

rows = unused_rows(randperm(length(unused_rows),N_UE_rows))

3 件のコメント

Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 17 日
i tried but i am not getting the result actually need. the result what i actually need is the number present in each row for every iteration should be same.Let me have an example for the output.
iteration-1
rows = 3 4
rows = 1 2
iteration-2
rows =3 4
rows =1 2
iteration-3
rows =3 4
rows =1 2
iteration-4
rows =3 4
rows =1 2.
i want to have the result in the above mentioned manner.could you please help me on this.
Walter Roberson
Walter Roberson 2018 年 4 月 17 日
set the same rng() for every iteration.
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 17 日
when i used rng() the number in each rows remain fixed whereas the gain corresponds to the rows also getting fixed.My aim is to run with different iterations by fixing the number in each rows which corresponds to different gain values for each iteration.so could you please help me how to fix the number in each rows with different gain values corresponding to different iterations.

この質問は閉じられています。

質問済み:

2018 年 4 月 13 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by