Hi! Please help. I have an Excel table loaded into matlab. The first column contains names while the second column contains the numerical values it represents. Here's the sample of the code used:
% --- Executes just before samplegui is made visible. function samplegui_OpeningFcn(hObject, eventdata, handles, varargin) ..... [~, material_text, ~] = xlsread('MyExcel.xlsx','A2:A35'); list = material_text; set(handles.popupmenu1,'string', list);
materialName = get(handles.popupmenu1, 'string'); materialRow = find(~cellfun('isempty',strfind(material_text,materialName)));
I used this to get the row number of the material selected in the pop up. Then,
% --- Executes on selection change in popupmenu1. function popupmenu1_Callback(hObject, eventdata, handles) ..... [~,~,material_all] = xlsread('MyExcel.xlsx','A2:D35'); materialValue = material_all{materialRow,2}; set(handles.edit6, density);
I used the row number to call the matching materialValue, but when I run the gui i get the following error:
Error using strfind PATTERN must be a single string.
I don't understand what the system's say that it must be a single string. Pls help. Thanks.