Replacing the contents of a matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dubstep Dublin
am 30 Jan. 2016
Kommentiert: Star Strider
am 30 Jan. 2016
I have a 1 dimensional matrix (1000 x 1) that consists of numbers from 0 to 63.
I would like to replace the contents of this matrix as follows:
0 --> 0
1 --> 0.5
2 --> 1
3 --> 1.5
and so on..
Can someone please show me how to do this.
Thanks
0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Jan. 2016
It looks as though you’re just dividing every element by 2, and rounding to one decimal place.
Letting ‘v’ define your vector, this works:
Out = fix(5*v)/10;
2 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices 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!