你能帮助我吗?我有矩阵,但我想要在矩阵中有更多的“fixed_part”并随机选择。同样重要的是每一行都是独一无二的。你可以帮帮我吗?在矩阵中随机排序位
clear all
clc
ntags = 50;
fixed_part = 20;
IDlength = 64;
tag_population = [zeros(ntags, fixed_part), floor(rand(ntags,IDlength-fixed_part)*2)];
tag_population = unique(tag_population,'rows');
查找这个矩阵:
0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1
0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1
0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1
在这个例子中我有四个不同类型的 “fixed_part” 的。
对不起,您所说的“更多fixed_part”是什么意思?更高的价值? – hbaderts
@hbaderts,''fixed_part''表示'0和1'随机排序的组之间有多少'0'。我想要更多的'fixed_part'在矩阵 – NikolaC
我可能仍然理解你错了(对不起,如果是这样的话),但是你不能只将'fixed_part'设置为更高的数字。 30,得到那个? – hbaderts