- Open your App Designer project in MATLAB.
- Click on the "Code View" button to switch to the code editor.
- In the left pane, go to the Callbacks section
- Click on Add and add the startupFcn function. This function is automatically created when you create a new App Designer project.
- Inside the startupFcn function, you can add your initialization code. This code will be executed when the app starts.
- Save your changes.
App designer table - How can I add default data before runtime, to see the real layout?
8 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
Abhishek Chakram
2023-9-26
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:
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 个评论
Abhishek Chakram
2023-9-29
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!