There are 8 input arguments in my function unstable_L(T1,T2,z1,z2,z3,z0h,z0m,U).
I would like to create this function with 5 required inouts and 3 optional inputs in which the optional value will be my default values that I have set if the user do not fill in. How can I make it? Is there any mistake in my coding?
nargin = 8;
if nargin > 8
disp (" the function unstable_L_new has only maximum of 8 input paramaters")
else
% Fill in unset optional values.
switch nargin
case 5
if isempty(z0h)
z0h = 0.005;
elseif isempty(z0m)
z0m = 0.005;
elseif isempty(U)
U = 2.0;
end
case 6
if isempty(z0m)
z0m = 0.005;
elseif isempty(U)
U = 2.0;
end
case 7
if isempty(U)
U = 2.0;
end
end
end