function h = firls(N, F, A, K, ftype)
Should be:
function h = firls(N, F, A, varargin)
That will let it accept any number of arguments after A, and store them in a cell array named varargin. Then, a code block based in the number and type of varagin elements can determine how to run your code
Something with the form below might work:
switch numel(nargin)
case 3
<set defaults>
case 4
<Check if #4 is a weight vector or a string, set values, like K = varargin{1}, and defaults for the rest>
case 5
<verify the order is right, assign K= varargin{1}, ftype= varargin{2}>
otherwise
print_usage()
Then, check that K is valid, ftype matches, set vectors to columns or rows, etc.