In Matlab I often use functions in my script that output something to the command window in one or several ways, for instance like this:
function output = mySubFunction(input)
disp(['the input is: ', num2str(input)])
output = input * 2;
disp(['the output is: ', num2str(output)])
end
If I now use this function in my script it would look something like this:
data = 5;
disp('applying transformation...')
transformation = mySubFunction(data);
disp(['the result of the transformation is: ', num2str(transformation)])
This is of course a very simple example, in fact the functions are often quite complicated and give a lot of output. In this case, to keep a better overview of what is going on in my main script using my command window, I would like to suppress the disp() functions in my mySubFunction. Is there any way that I can do this simply from my main script (that is, without diving into possibly very complicated functions and subfunctions to comment out all disp() functions or insert semicolons)?