Randperm without number 1
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mary Hemler
am 14 Mai 2020
Bearbeitet: Stephen23
am 14 Mai 2020
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!