필터 지우기
필터 지우기

Prohibit "pcg" writing to command window

조회 수: 13 (최근 30일)
Daniel Döhring
Daniel Döhring 2018년 7월 4일
댓글: Josh Meyer 2019년 9월 23일
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
Geoff Hayes
Geoff Hayes 2018년 7월 5일
Daniel - what does the output of a successful call look like?
Daniel Döhring
Daniel Döhring 2018년 7월 5일
My whole command winwo is full of these messages, is there a way to suppress these messages?

댓글을 달려면 로그인하십시오.

채택된 답변

Geoff Hayes
Geoff Hayes 2018년 7월 5일
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
Daniel Döhring
Daniel Döhring 2018년 7월 5일
This works out, thanks!
Josh Meyer
Josh Meyer 2019년 9월 23일
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(...)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by