Varun - when you import the data from the Excel file, you are doing
handles.data1=xlsread(filename, selectedsheet)
data1=handles.data1
set(hObject, 'data1')
where the data1 field of the handles struct is being created and set to the data from the file. This is fine but what you need to do next is to save this new field to the structure (right now, you are just updating a local copy)
handles.data1=xlsread(filename, selectedsheet)
guidata(hObject, handles);
The other two lines (the second which may throw an error if the data1 field is not a property of hObject) can be removed. So remove
data1=handles.data1
set(hObject, 'data1')
Then in the popupmenu6_Callback, you would access data1 via
if isfield(handles, 'data1')
item=handles.data1(item_selected, 29)
end
The line get(handles.popupmenu1, 'data1') which is throwing the error, can be removed.
Best Answer