You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: op_iterativeWaterFilter.m
    path of file: ./repos/osprey/libraries/FID-A/processingTools
    
    the code of the file until where you have to start completion: %op_iterativeWaterFilter.m
%Georg Oeltzschner, Johns Hopkins University 2020.
%
% USAGE:
% out=op_iterativeWaterFilter(out,wlim,Kinit,M,plot_bool);
% 
% DESCRIPTION:
% This function is a wrapper to attempt error-free water removal using
% multiple instances of the op_removeWater function. This is necessary
% because at any given number of frequency components, the HSVD filter
% might end up removing the entire FID instead.
%
% To circumvent this problem, we begin with an initial guess of 'Kinit'
% components. Should the FID end up empty after filtering, this function
% starts a
    
function is a wrapper to attempt error-free water removal using
% multiple instances of the op_removeWater function. This is necessary
% because at any given number of frequency components, the HSVD filter
% might end up removing the entire FID instead.
%
% To circumvent this problem, we begin with an initial guess of 'Kinit'
% components. Should the FID end up empty after filtering, this function
% starts at 1.5*Kinit components, and decreases the Kinit variable by one
% until it arrives at a non-empty FID.

% At each step, the water signal is being removed using HSVD method 
% described by H. BARKHUIJSEN et al. 1987.
% 
% INPUTS:
% in        = MRS data structure used by FID-a toolkit. Data should be
%             pre-processed, for example by out = run_pressproc(filename)
% wlim      = This is the frequency limits of the water peak to be fitted in
%             ppm. (default = [4.4 5]
% Kinit     = The number of frequency components in the data model This parameter
%             might have to be played with. (default is 20).
% M         = M is the integer number of columns in the henkel matrix. Note: L
%             is the number of rows and L+M=N where N is the number of data
%             points. For best results 0.5<=L/M<=2. (default M= .75*length.
% plot_bool = if 1, water fit is plotted (default =1)
%
% OUTPUTS:
% out       = New spectrum without the water peak in the as a FID-A structure

function [out] = op_iterativeWaterFilter(in,wlim,Kinit,M,plot_bool)

% set default values ( intend