Error loading data into popup menu GUI

8 次查看(过去 30 天)
Hello,
I'm creating a GUI in which I import data from an Excel and I want the name of the columns to appear as options in a pop-up menu. The problem is that it doesn't happen and an error appear. What can I do? I think the error is in the last line but I do not know how to solve it.
Thank you very much!!! Pedro
This is my code:
function datagraphV1
f=figure('Visible','off','Position',[100,100,450,285]);
hload=uicontrol('Style', 'pushbutton',...
'String','Load .xlsx','Position',[315,220,70,25],...
'Callback',{@loadbutton_Callback});
hpopupX=uicontrol('Style','popupmenu',...
'String',{'popupmenuX'},...
'Position',[300,75,100,25],...
'Callback',{@popupX_Callback});
function loadbutton_Callback(hObject,eventdata,handles) %Function callback for loading the Excel and changing the
pop-up menu X.
handles.filename=uigetfile('*.xlsx');
guidata(hObject,handles);
[Comp, Prod, OthInfo, colnames,numcolum]=extractdataexcelV2(handles.filename);
hpopupX.String=colnames;

回答(1 个)

Niels
Niels 2017-10-7
Hi Pedro,
[Comp, Prod, OthInfo, colnames,numcolum]=extractdataexcelV2(handles.filename);
extractdataexcelV2
I have never seen this command before. If you want to extract data from an excel file you can use xlsread
like:
[number, text] = xlsread(filename,range); % xlsread('testfile.xlsx','A6:F32');
If text is a vector, your last line should be fine
in my example:
hpopupX.String=text;
  1 个评论
Pedro Galvez
Pedro Galvez 2017-10-7
Hi Niels, it is a function I have created in order to take directy the information I need.
Thanks!

请先登录,再进行评论。

类别

Help CenterFile 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!

Translated by