Hi,
You can simply translate the vector to the origin Multiply the point by the rotation Matrix and then again translate the point back to the rotation point (end point). The following code may help.
Rotation_matrix = eul2rotm([pi/2,0,0]) %rotation matrix
point1 = [1,2,0]; %end point of line, we will rotate about this point
point2 = [4,5,0]; %end point of line
Point2new = point1 + [point2-point1]* Rotation_matrix