Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Problem 1278. Find the nearest integer

Created by Bruce Raine

Given a vector of integers and a real number find the closest integer.


>> a = [2 4 5 6 8 10];

>> b = 4.6;

>> nearestNumber(a,b)



Problem Group

Solution Statistics

109 correct solutions 50 incorrect solutions
Last solution submitted on Oct 13, 2015

Problem Comments