Clear Filters
Clear Filters

App Designer Tab name xlsl

18 views (last 30 days)
Daniel on 23 Sep 2022
Commented: Daniel on 24 Sep 2022
Hi, im new, I never used matlab and the app designer, but I need to do a project and for now I only need to know how to assign the name of a tab to the name of a cell of the selected excel.
I know how to read xlsl files, but I tried all the day to do that and I can't. The file cells are something like: "%%Motor speed" (I dont have right now the excel to share a image but there are like this) and they have the "%" and I know in matlab % is for comments so probably theres something that I dont know and the "%" are for something.
Matlab sometimes says "Warning: Variable names were modified to make them valid MATLAB identifiers. The original names are saved in the VariableDescriptions property." Here are some examples of what I need to do:
I know this is probably a stupid question for someone who knows how this works, but I dont really have that much time.

Accepted Answer

Turlough Hughes
Turlough Hughes on 24 Sep 2022
Have a look at your component browser in the app designer, and you'll see app.Tab1 or something similar (as shown above).
Click on app.Tab1 and you will get a list of the Tab's properties - one of those properties is Title. You can modify this property in code-view by:
app.Tab1.Title = strrep(theValueFromExcel,'%',''); % I just use strrep to remove the '%' symbol.
I recommend making a Startup function to set that property, which runs automatically when you open the app. So, you can place that line of code inside the StartupFcn to set the tab name when the app is instantiated. Just make sure that theValueFromExcel is available before your call the the above code snippet.
To create a StartupFcn, navigate to the component browser, right click the top of the tree (i.e. app1 or whatever your app is called) and go to >> CallBacks >> Add StartupFcn callback.
Regarding your concern on the '%' symbol, if you load that into a variable (e.g. theValueFromExcel, in the above code snippet) it will not cause any code to be skipped.
If you can manage this, I would say you're doing quite well for someone who's never used Matlab before.

More Answers (0)


Find more on Develop Apps Using App Designer in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!