Error loading data into popup menu GUI

2 ビュー (過去 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 Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by