![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1134970/image.png)
App Designer Tab name xlsl
조회 수: 6 (최근 30일)
이전 댓글 표시
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1134415/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1134420/image.png)
I know this is probably a stupid question for someone who knows how this works, but I dont really have that much time.
댓글 수: 0
채택된 답변
Turlough Hughes
2022년 9월 24일
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1134970/image.png)
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.
추가 답변 (0개)
참고 항목
카테고리
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!