Main Content
Set Output Port Properties
The colorSensor.m
reference System object™ contains a common default implementation of the methods that defines the
output port properties for the block. Update the properties as follows.
methods (Access = protected) %% Define output properties function num = getNumInputsImpl(~) num = 0; end function num = getNumOutputsImpl(~) num = 3; end function varargout = isOutputFixedSizeImpl(~,~) varargout{1} = true; varargout{2} = true; varargout{3} = true; end function varargout = isOutputComplexImpl(~) varargout{1} = false; varargout{2} = false; varargout{3} = false; end function varargout = getOutputSizeImpl(~) varargout{1} = [1,1]; varargout{2} = [1,1]; varargout{3} = [1,1]; end function varargout = getOutputDataTypeImpl(~) varargout{1} = 'double'; varargout{2} = 'double'; varargout{3} = 'double'; end function icon = getIconImpl(~) % Define a string as the icon for the System block in Simulink. icon = 'Color Picker'; end end
In the next section, you will Create MATLAB System Block.