Hardlim matlab function should look like a step:
But the code provided at the documentation page
n = -5:0.1:5; a = hardlim(n); plot(n,a)
gives me this output:
The error you see is caused by the plotting: You sample the function from $-5$ to $5$ with step size $0.1$, and plot these values.
... -0.2 => 0 -0.1 => 0 0 => 1 0.1 => 1 ...
Plotting module then connects these points with a line that looks exactly like your image.