App Designer Tab name xlsl

8 ビュー (過去 30 日間)
Daniel
Daniel 2022 年 9 月 23 日
コメント済み: Daniel 2022 年 9 月 24 日
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.

採用された回答

Turlough Hughes
Turlough Hughes 2022 年 9 月 24 日
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.
  1 件のコメント
Daniel
Daniel 2022 年 9 月 24 日
It worked perfect, thanks you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by