How can I create a vector that has all of the elements of a random vector, but will add 1 to each of the odd elements?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Claire
am 5 Mär. 2014
Kommentiert: Claire
am 5 Mär. 2014
I created a row vector of 20 random integers from 0-50 and would now like to create a new vector which has all of the elements of the first vector, but adds one to each of the odd elements. How would I go about this?
>> A=randi([0 50],1,20);
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation 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!