I am reading the excel spreadsheet as follows:
function upload_Callback(hObject, eventdata, handles)% hObject handle to upload (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject, handles);[FileName1,PathName1] = uigetfile({'*.xls';'*.txt';'*.csv';'*.*'},'Select the text file that contains the data');if isempty(FileName1) errordlg('No file was selected that contains the data so the calculation was aborted.'); flag = true; returnendS3.selected_dir_upload =fullfile(PathName1,FileName1);handles.S3.selected_dir_upload =S3.selected_dir_upload ;[S3.num, S3.txt]=xlsread(S3.selected_dir_upload)set(handles.upload_file, 'String', S3.selected_dir_upload)set(handles.upload, 'UserData', S3);
After that I have a popup menu which should populate the texts from the excel sheet. For which I am trying this:
function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
S3 = get(handles.upload, 'UserData');set(handles.popupmenu1,'String',S3.txt);
But I am not able to get the list updated once the excel is read. Please suggest!
Best Answer