rounding of the numbers in a array as per a condition
2 次查看(过去 30 天)
显示 更早的评论
hi..
suppose i have an array x=[1 ,2, -2.2, 2.2, -3, 4];
all the elements of the above array should satisfy the condition that they should lie in the interval [-2 2];
if any element is less than '-2' then i should round-off it to '-2'.
if any element is greater than '2' then i should round-off it to '2'.
but remaining elements should be unchanged.
so,finally i should get the answer as x = [1 ,2 ,-2 ,2, -2, 2];
is there a smart coding way with out using loops.
Regards.
Chandradhar Savanth...
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!