%if((InputPort1.TypeSignal == 'Optical') && (InputPort2.TypeSignal == 'Optical' ) && (InputPort3.TypeSignal == 'Optical') && (InputPort4.TypeSignal == 'Optic
% OutputPort1=InputPort1;
[la, ca] = size(InputPort1.Parameterized);

 if( la > 0 )
 % Calculate the signal attenuated in the x polarization
 a = InputPort1.Parameterized.Power;
%  end;

 [lb, cb] = size(InputPort2.Parameterized);

 if( lb > 0 )
 % Calculate the signal attenuated in the x polarization
 b = InputPort2.Parameterized.Power;
%  end;
 [lc, cc] = size(InputPort3.Parameterized);

 if( lc > 0 )
 % Calculate the signal attenuated in the x polarization
 c = InputPort3.Parameterized.Power;
%  end;
%  [ld, cd] = size(InputPort4.Parameterized);

%  if( ld > 0 )
%  % Calculate the signal attenuated in the x polarization
%  d = InputPort4.Parameterized.Power;
%  
%  end;
 A= [a b c];
maxp = max(A);
if (maxp == 'a')

    OutputPort1 = InputPort1;
end;
 if (maxp == 'b')

 OutputPort1 = InputPort2;
 end;
%     else  (maxp == 'c')
    if (maxp =='c')
   OutputPort1 = InputPort3;
    end;
%         else
%            OutputPort1= InputPort4;
%         end;
%     end;
% end;

    
    

 end;
 end;
 end;
%  end;
 
%end;
