function varargout = LL_Leitwert_freie_Konvektion_Strahlung( varargin )

p = inputParser();

p.KeepUnmatched = false;

p.CaseSensitive = false;

p.StructExpand = false;

p.PartialMatching = true;

addParameter( p, 'HorizontalArea' , nan )

addParameter( p, 'VerticalArea' , nan )

addParameter( p, 'OutsideDiameter' , nan )

addParameter( p, 'InsideDiameter' , nan )

parse( p, varargin{:} )

ip = p.Results;

fprintf( '%16s %s\n', 'name' , 'value' )

fprintf( '%16s = %f\n', 'HorizontalArea' , ip.HorizontalArea )

fprintf( '%16s = %f\n', 'VerticalArea' , ip.VerticalArea )

fprintf( '%16s = %f\n', 'OutsideDiameter', ip.OutsideDiameter )

fprintf( '%16s = %f\n', 'InsideDiameter' , ip.InsideDiameter )

is_case_1 = isempty( setxor( {'VerticalArea' ,'OutsideDiameter'}, p.UsingDefaults ));

is_case_2 = isempty( setxor( {'VerticalArea' ,'InsideDiameter' }, p.UsingDefaults ));

is_case_3 = isempty( setxor( {'VerticalArea' }, p.UsingDefaults ));

is_case_4 = isempty( setxor( {'HorizontalArea','OutsideDiameter'}, p.UsingDefaults ));

is_case_5 = isempty( setxor( {'HorizontalArea','InsideDiameter' }, p.UsingDefaults ));

is_case_6 = isempty( setxor( {'HorizontalArea' }, p.UsingDefaults ));

assert( any( [is_case_1,is_case_2,is_case_3,is_case_4,is_case_5,is_case_6] )...

, 'abc:def:IllegalInputCombination' ...

, 'Your combination of inputs is illegal' )

varargout = { ip, p };

end

>> [ip,p] = LL_Leitwert_freie_Konvektion_Strahlung( 'HorizontalArea',1, 'o',3, 'i',4, 'v',2 );

name value

HorizontalArea = 1.000000

VerticalArea = 2.000000

OutsideDiameter = 3.000000

InsideDiameter = 4.000000

Error using LL_Leitwert_freie_Konvektion_Strahlung (line 30)

Your combination of inputs is illegal

## 5 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718414

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718414

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718416

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718416

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718426

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718426

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718431

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718431

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718434

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/468940-use-of-nargin-and-varargin#comment_718434

Sign in to comment.