App Designer Drop Down to load excel data
조회 수: 9 (최근 30일)
이전 댓글 표시
I have an excel sheet which has the first colum being a name, each colum after has numerical data accociated with each name (Name and date acociated with name have ther own row). I would like to use a drop down to select the name from the excel document which would in turn pull in all the data asociated with that name. The list of names from the drop down also needs to be pulled from the first colum in the excel document since it is a living document.
댓글 수: 2
Mario Malic
2021년 1월 28일
Hello,
This is highly reliant on how your Excel data is structured. Is there a pattern where the data associated with the person is located?
답변 (1개)
Mario Malic
2021년 1월 28일
If you use readtable on your file, you'll get a nice table already prepared with the data. After you import, check if your numbers are actually imported as numbers.
t = readtable('filename.xlsx');
app.DropDownMenu.Items = t{:,1};
app.DropDownMenu.ItemsData = 1:length(app.DropDownMenu.Items);
When you set the ItemsData property this way, the number will be present in the Value property, and you can use it to index into particular rows of the table.
selectedRow = app.DropDownMenu.Value;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!