Reputation:
I want to round of 23.456 as 23.5 how to do this.
I could not find any specific function for this in MATLAB.
Upvotes: 0
Views: 1561
Reputation: 1035
Here you go
Loki=[13.47471556 12.36547 21.0; 45.31 54.326 456.23; 12.2 45.14 65.39]
Ndecimals = 1 ;
Thor = 10.^Ndecimals ;
Loki = round(Thor*Loki)/Thor
See the round off Loki
Loki (default)
13.4747 12.3655 21.0000
45.3100 54.3260 456.2300
12.2000 45.1400 65.3900
Loki (round off)
13.5000 12.4000 21.0000
45.3000 54.3000 456.2000
12.2000 45.1000 65.4000
Upvotes: 3