App designer table - How can I add default data before runtime, to see the real layout?

8 visualizaciones (últimos 30 días)
I'm trying to design an app with a set of numeric data shown in a few tables.
I can't find any way to give the table data in the app designer, or even make the row names show up at all. It makes it really difficult to design column widths and the overall size of the component, because everything resizes once the app runs and data is added.
My data is typically all a fixed number of digits so having a fixed column width is fine, but right now the only way I can figure out is to run the app, add some data, force a breakpoint, query the live column sizes, copy those to the app designer in its weird format in a single edit box, and try running again to see if it's right. And I have to be pixel perfect to guess the size of the component so it doesn't show a big white space if too big, or scroll bar if too small.
Coming from GUIDE on R2015a where this was easy, it seems odd that I can't find a way to do this...
Thanks!

Respuestas (1)

Abhishek Chakram
Abhishek Chakram el 26 de Sept. de 2023
Hi John Taseff,
It is my understanding that you are facing difficulty in adding data before runtime or adding default data in the startup state of the application.
Here are the steps for the same:
  1. Open your App Designer project in MATLAB.
  2. Click on the "Code View" button to switch to the code editor.
  3. In the left pane, go to the Callbacks section
  4. Click on Add and add the startupFcn function. This function is automatically created when you create a new App Designer project.
  5. Inside the startupFcn function, you can add your initialization code. This code will be executed when the app starts.
  6. Save your changes.
Here is a sample of a startupFcn function:
function startupFcn(app)
app.label.Text = `App Initialized`;
end
In this example, the startupFcn function is adding an initialization code that sets the text of a label (app.Label.Text) to "App Initialized". You can replace this code with your own initialization logic.
Best Regards,
Abhishek Chakram
  2 comentarios
John Taseff
John Taseff el 26 de Sept. de 2023
Thanks for answering. Unfortunately this doesn't solve my issue.
I want to put the data in directly when designing the app layout. For a Table, I want to see some data in the table in AppDesigner, so I can adjust the column widths and table widths, without having to run the app.
Abhishek Chakram
Abhishek Chakram el 29 de Sept. de 2023
Hi John Taseff,
Thank you for bringing this to my attention. I guess that the specific functionality that you are requesting is not currently supported in App Designer.
To address your concern and explore possible alternatives or workarounds, I recommend reaching out to the official MathWorks Support team.
Best Regards,
Abhishek Chakram

Iniciar sesión para comentar.

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by