You have the following important line in your code commented out (the definition of the solve_friction_factor() function). Uncomment that and add an end to close out that function.
% function f = solve_friction_factor(Re)
After that, if you step through the code, it will become obvious that there is something wrong with your calculations. You will find that delta_f quickly blows up to Inf, which never is less than 1e-4, so you get stuck in an infinite loop.
You need to double check your equations.
Also, when you post code, please format it as code (select it and press the left hand button in the CODE section of the toolstrip).