MATLAB: Fprintf in if statement

fprintf

Hi,
Is there a way to only fprintf data while using an if statement. For example, if x = 1, fprintf ('hello');
Thanks

Best Answer

if x == 1 % where x is assumed as a scalar
fprintf('hello')
end
help if
doc if
Related Question