Displaying Data From a MATLAB Function

I have a MATLAB Function embedded in a simulation that is called cyclically. I would like to display information from that function as the simulation runs. I tried both disp() and fprint() but the information does not appear in the Command Window as the simulation runs. I verified that it hits the display lines by using a debug break. disp() lines that are placed in various .m files that initialize and start the simulation all appear as expected in the Command Window, just not those that are in the cycling MATLAB Function.

댓글 수: 2

Albert Fan
Albert Fan 2018년 7월 18일
I think the issue might be the stdout is dropped or flushed to somewhere else since it is called in a simulation. While I don't have much idea over that, you can simply save what shall be printed in your fprintf() function into a txt file locally and check that file you wrote after you've finished your simulation.
Tom
Tom 2018년 7월 19일
I suspect you are right about stdout. I did a little research on that but didn't find a smoking gun. I'm sure I used to do this all the time without issue, but something seems to have changed or I've forgotten something about the process that makes it work. Thanks for the recommendation to just log the data and review it post-Simulation.

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

답변 (0개)

제품

릴리스

R2017a

태그

질문:

Tom
2018년 7월 18일

댓글:

Tom
2018년 7월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by