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

38 Ansichten (letzte 30 Tage)
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 Kommentare
Jan
Jan am 16 Mär. 2022
What is "object" in your fprintf command? An edit field is the standard to display and edit text.
Tom Coté
Tom Coté am 16 Mär. 2022
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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 16 Mär. 2022
Bearbeitet: Jan am 16 Mär. 2022
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 Kommentare
Joseph Keogh
Joseph Keogh am 11 Sep. 2023
Preferably avoiding eval statements to avoid exploits in security
Huy
Huy am 5 Feb. 2025
Verschoben: Voss am 5 Feb. 2025
Hi Tom, just want to give you a credit for the simple solution that you have!
Thank you a lot!
Sincerely,
Huy

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Desktop finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by