简体   繁体   中英

How do I display data/information with Matlab App Designer?

I would like to display some information to the user via Matlab App Designer's GUI. I am new to this program and can't seem to find a widget that provides what I feel should be a simple function. Am I missing something? Examples would include showing the user:

  1. The path of the file that he/she selected
  2. Errors such as "No files detected" that are printed in a Matlab script called on by the GUI code.
  3. Other print statements in code such as "Done!", etc that will inform the user when a process is complete.

Is there a way to capture the output in the Matlab command line and report these in a window of some sort in the GUI? Thanks in advance!

You can use a TextArea to display information for the user. Here's how I made a simple example:

  1. Drag a button to the app in design view.
  2. Drag in a text area also. I changed the label to Feedback.
  3. Select the button and use the Callbacks tab in the bottom right of app designer to add a callback with the default name it gives you.
  4. Edit the callback to contain

      answer = 'what your want to display'; app.FeedbackTextArea.Value = answer; 

When you push the button the text area gets filled. In your code, instead of just setting 'answer' to some string, set a variable using whatever code is dealing with your user's information. The key is to store what you want the user to see in a variable and then assign that to the "Value" parameter of the text area or other widget where you want them to see the results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM