MATLAB: How to generate a Command Window error from Simulink block mask editor (Initialization Tab)

command windowerrorerrordlgMATLABsimulink

I would like to do some input validation of the block mask parameters, and in the case that the input is out of range, output an error message.
Using "errordlg" is annoying because if the parameter is a workspace variable that changes and you've used the block in N places in the model, suddenly you have N pop-up dialogs.
Using the Command Window to display these errors is a more comfortable option. But when I try the following inside the Initialization tab of the mask editor:
if num<0
error('Number must be positive: "%s"', gcb);
end;
I get a pop-up anyway saying: Error due to multiple causes. –> Error in 'untitled/myblock': Initialization commands cannot be evaluated. –> Number must be positive: "untitled/myblock"
Is there any way to get Simulink to output to the Matlab command window?
Thanks!

Best Answer

disp() command would display whatever you want to display in the command window.