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

41 次查看(过去 30 天)
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 个评论
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 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by