How do I use MATLAB app designer to display a command window for my app?

조회 수: 37 (최근 30일)
Tom Coté
Tom Coté 2022년 3월 16일
이동: Voss 2025년 2월 5일
I am converting a program I wrote in regular scripts to an app. I want to be able to have a window in my app that I can write data to.
I have been trying to use
fprintf(object,"Some Text\n")
I have tried using the slrealtime System Log block but I cannot print to it.
I also tried writing to a file and then pulling that back into the app at the end of execution.
I need to print text to the app somehow. How should I be attacking this.
  댓글 수: 3
Jan
Jan 2022년 3월 16일
What is "object" in your fprintf command? An edit field is the standard to display and edit text.
Tom Coté
Tom Coté 2022년 3월 16일
I tried using
fprintf(app.SystemLog,"Text");
And then I tried a different approach
lg = fopen('Log.txt','W')
fprintf(lg,"Text")
But then I could not get the text to display in my app
I'll give an edit field a shot

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

채택된 답변

Jan
Jan 2022년 3월 16일
편집: Jan 2022년 3월 16일
This is "gun-shot programming". Please read the documentation:
doc fprintf
doc fopen
Both commands do not write text to a GUI element. How did you create app.SystemLog?
Does your app.SystemLog has a property called "Value"? Try
app.SystemLog.Value = "Hello"
  댓글 수: 5
Joseph Keogh
Joseph Keogh 2023년 9월 11일
Preferably avoiding eval statements to avoid exploits in security
Huy
Huy 2025년 2월 5일
이동: Voss 2025년 2월 5일
Hi Tom, just want to give you a credit for the simple solution that you have!
Thank you a lot!
Sincerely,
Huy

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by