I have write this code to find the Y values of a line, given two points and slope (calculate previous call the funtion), its to simple but in implementation i calling this function around 10 million times, so i need te reduce the time that it takes, if someone have some advice it would be helpful thank you!!!.
function[y] = LineFuntion(pts,m,Pi,Pf)
if abs(m) == Inf
y(1:pts) = linspace(Pi(2),Pf(2),pts);
elseif m == 0
y(1:pts) = Pi(2);
x(1:pts) = linspace(Pi(1),Pf(1),pts);
y(1:pts) = m*(x-Pi(1))+Pi(2);