Suppressing Function Console Output

8 views (last 30 days)
Im attempting to suppress the output of text to the console generated by a function. I'm aware this question has been asked several times in different formats, but unfortunately that hasn't resolved my issue.
First I will outline my code.
for i = 2:length(lreturns)
holder = garchvar(lreturns(1:i), 'GARCH', 'GAUSSIAN', 1, 1, 1, 1, 1, 0.05);
GARCH_Gaussian_VaR(i) = holder(1);
end
Each iteration of the function garchvar() generates a lower and upper number. My code creates a vector of these lower numbers and works fine for that purpose.
However, the function also generates a lot of unwanted output to the console - around 75 lines of text.
Things I have done to attempt to resolve this issue are:
Using evalc in the following way:
for i = 2:length(lreturns)
holder = evalc(garchvar(lreturns(1:i), 'GARCH', 'GAUSSIAN', 1, 1, 1, 1, 1, 0.05));
GARCH_Gaussian_VaR(i) = holder(1);
end
But this just gives the error message:
Undefined function 'evalc' for input arguments of type 'double'.
Ive tried to debug the function and comment or put semi-colons where output is generated. Embedded within garchvar is another function, and embedded within that function is another and so on. The first output is printed when I arrive at the following line of the function fmincon.m which is in the optimlib toolbox. When debugging step by step the first output is delivered after the line:
if diagnostics
% Do diagnostics on information so far
diagnose('fmincon',OUTPUT,flags.grad,flags.hess,flags.constr,flags.gradconst,...
XOUT,sizes.mNonlinEq,sizes.mNonlinIneq,lin_eq,lin_ineq,l,u,funfcn,confcn);
end
Even after Ive commented this section, this does not suppress the output. Hence I'm quite confused by this. If I continue to debug, the function does not provide the same output as if I run the function in normal mode.
So my question is how can I run my code and suppress all output to the console given that what I have tried hasn't worked.
Thanks

Accepted Answer

Walter Roberson
Walter Roberson on 6 Sep 2015
holder = evalc('garchvar(lreturns(1:i), ''GARCH'', ''GAUSSIAN'', 1, 1, 1, 1, 1, 0.05)');

More Answers (0)

Categories

Find more on Conditional Variance Models in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!