How to open an excel file from the listbox(having a number of excel files) in gui(GUIDE)?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (2)
Image Analyst
el 9 de Oct. de 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);
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!