How to open an excel file from the listbox(having a number of excel files) in gui(GUIDE)?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Image Analyst
2014 年 10 月 9 日
% 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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!