Round towards target matrix
6 次查看(过去 30 天)
显示 更早的评论
Hi @ all :)
I have a small problem with rounding values of a base matrix towards the values of a target matrix. The matrices looks like this:
Base matrix:
# 1.12
# 1.16
# 2.0
# 1.78
# 2.3
# 3.1
# 3.67
# 1.1
# 0.3
Target matrix:
# 0
# 0.3
# 0.8
# 1
# 1.5
# 2.4
# 2.5
# 3.1
# 3.3
# 4
Now I want to round the values of the base matrix to the values of the target matrix, resulting to this "round values":
# 1.12 -> 1
# 1.16 -> 1
# 2.0 -> 2.4
# 1.78 -> 1.5
# 2.3 -> 2.4
# 3.1 -> 3.1
# 3.67 -> 4.0
# 1.1 -> 1
# 0.3 -> 0.3
In both matrices the differences/spacing between the values are irregular. Using "ceil", "floor", "round" I have no chance to solve this problem... (or only with regular spacing)
Thanks a lot for any kind of help!
Reik
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!