Info

This question is closed. Reopen it to edit or answer.

How can I get a especific 'String' from an upgradeable popup menu?

1 view (last 30 days)
Hi, I am creating a GUI where I choose a option from a popup menu who upgrades from a .xlsx file, the .xlsx file is like a database where I import data to fill "static's text" in the GUI, but I have a problem cause when I choose a option from the pop up menu the variable "columnas" I get a composite vector with all elements of the pop up menu, so I cant compare "columnas" with a specific cell of the .xlsx file.
code:
filename = 'libro1.xlsx';
[a,b,c]=xlsread(filename,'hoja1')
set(handles.consola,'String',b(1,1:end)) %consola=tag of popup menu
columnas=get(handles.consola,'String')
for i=1:size(b,2)
comp = b{1,i}
if comp == columnas
columleer = i
end
end
set(handles.precio,'String',b(3,columleer))
and then appears this error:
??? Undefined function or method 'eq' for input arguments of type 'cell'.
Error in ==> programaejemplo>consola_Callback at 96
if comp == columnas
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> programaejemplo at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)programaejemplo('consola_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
What can I do to get only one option from the popup menu and dont get the whole list??
thanks
  1 Comment
Jan
Jan on 5 Oct 2014
The question is not clear: columnas contains the same cell string as b. Now you compare eash element of b with the complete cell string columnas. Even if you use strcmp() for the string comparison, or perhaps find(strcmp(comp, columnas)), it is not clear, what columleer should contain finally.
What is the purpose of the code?

Answers (0)

Community Treasure Hunt

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

Start Hunting!