MATLAB: How to display text only one time from Simulink MATLAB Function Block

simulinksimulink matlab function

When i used disp or fprintf command on Simulink MATLAB function,it displays many times like in figure attached. I need to display the text only one time. Please help me
Here is my problem:
function y = fcn(u)
%#codegen
y = u;
disp('What is the value of y')
end
It displays following many times. But I need to display it only once. Please help me
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y
What is the value of y

Best Answer

persistent flag
if isempty(flag)
disp('What is the value of y');
flag = 0;
end