Error loading data into popup menu GUI

조회 수: 3 (최근 30일)
Pedro Galvez
Pedro Galvez 2017년 10월 7일
댓글: Pedro Galvez 2017년 10월 7일
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에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by