Reputation: 37
I need create a matrix with no floating point values in MATLAB. For example I have created the following matrix a
:
a =
1.0000 0 0 0 25.0000
1.0000 0 1.0000 0 50.0000
1.0000 0 0 1.0000 50.0000
0 0 0 0 50.0000
0 0 0 0 50.0000
0 1.0000 1.0000 0 83.3333
But I would like the following matrix:
a =
1 0 0 0 25
1 0 1 0 50
1 0 0 1 50
0 0 0 0 50
0 0 0 0 50
0 1 1 0 83
Upvotes: 2
Views: 87
Reputation: 36710
To change the value, use the function floor
ceil
or round
. To change the data type, use int32
or similar.
Upvotes: 6