r = 1+randperm(N-1,N20);
Randperm without number 1
1 次查看(过去 30 天)
显示 更早的评论
I am using randperm to select positions that will be changed. How can I change my code so that the number 1 (position 1) is not included?
N = 50;
N20 = .2*N;
r = randperm(N,N20); %positions that are about to be changed
for y=r
S20a(:,y)=2*round(rand(1)) - 1;
end
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!