How to open an excel file from the listbox(having a number of excel files) in gui(GUIDE)?
Ältere Kommentare anzeigen
Hi, I have made a gui(having a pushbutton and a listbox).I am using the pushbutton to select some excel files from a directory(in My computer)and showing them in listbox.Now I want to open excel files from the listbox by clicking the respective file.Please tell me how to use 'winopen' function and where to use it(under callback function of listbox or under pushbutton callback function(here I have written the code for opening the window to select files and then displaying them in listbox).Thanks for your help.
Antworten (2)
Image Analyst
am 9 Okt. 2014
% Get a list of indexes in the listbox that the user has selected.
Selected = get(handles.lstExcelFiles, 'Value');
% If more than one is selected, bail out.
if length(Selected) > 1
return;
end
% If you get to here, exactly 1 is selected.
% Now, get a list of all the items in the listbox.
ListOfFileNames = get(handles.lstExcelFiles, 'string');
% Get the name of the one particular file that has been selected.
baseFileName = strcat(cell2mat(ListOfFileNames(Selected)));
% Get the full file name by prepending the folder where the files live.
excelFullFileName= fullfile(folder, baseFileName);
% Open file in Excel.
winopen(excelFullFileName);
Muhammad Hussain
am 13 Okt. 2014
0 Stimmen
Kategorien
Mehr zu Spreadsheets finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!