设置输出端口属性
colorSensor.m 参考 System object™ 包含定义模块的输出端口属性的方法的通用默认实现。按如下方式更新属性。
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
在下一部分中,您将创建 MATLAB 系统模块。