Prohibit "pcg" writing to command window

14 views (last 30 days)
Hello,
I got a more cosmetic question concerning matlab function "pcg" https://de.mathworks.com/help/matlab/ref/pcg.html. Is there a way to prevent a command line output from pcg after each (un)successful call? It is annoying and might even slow my program down due to the writing to the command window. Thanks in advance, Daniel
  4 Comments
Geoff Hayes
Geoff Hayes on 5 Jul 2018
Daniel - what does the output of a successful call look like?
Daniel Döhring
Daniel Döhring on 5 Jul 2018
My whole command winwo is full of these messages, is there a way to suppress these messages?

Sign in to comment.

Accepted Answer

Geoff Hayes
Geoff Hayes on 5 Jul 2018
Daniel - Wow that is busy. Perhaps try doing
[x,~,~,iter] = pcg(Id-(tspan(i+1)-tspan(i))*A, U(:,i));
U(:,i+1) = x;
I noticed that if I just did
[x] = pcg(Id-(tspan(i+1)-tspan(i))*A, U(:,i));
then I would observe the pcg converged at ... message. But with the other line of code where I have an iteration output parameter, iter, then the message is suppressed.
  2 Comments
Josh Meyer
Josh Meyer on 23 Sep 2019
To clarify for future readers: if you specify the second FLAG output then the function stops printing convergence information to the command window. Instead the value of the FLAG output conveys whether the attempt was successful.
[x,flag] = pcg(...)

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!