I have a short function which uses textscan to read data into a variable.
My problem is that I always get this:
>>function('function.txt')
    ans = 
        {10x1 cell}    {10x1 cell}    {10x1 cell}    [10x1 double]
Is there any way to suppress this, apart from adding a semi colon to the end of the line I use to call the function? I'd like to be able to suppress it without adding the semi colon. I don't want to display anything at all when running this function, I just want to load my file.
You can suppress the output by remove output arguments (or return values) of the function.
OR
Try use Variable Number of Outputs, see Support Variable Number of Outputs
function varargout = foo
    nOutputs = nargout;
    varargout = cell(1,nOutputs);
    for k = 1:nOutputs;
        varargout{k} = k;
    end
end
You type >>foo and get nothing.
You type >>a=foo and get >>a=1.
You type >>[a,b]=foo and get >>a=1 >>b=2.
You can thus suppress output by NOT providing any output arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With