Execute files from listbox one by one
1 回表示 (過去 30 日間)
古いコメントを表示
GUI load some files using Pushbutton1 inside Listbox1. Now i have got another pushbutton2 to select all the files populated in listbox1. Now I would like to read all data from the files in listbox1 one by one. callback for pushbutton3 should be such that it should get all the filenames from _ listbox1_ and read it individually. Some how am not able to do it. Do i need callback for listbox1 as well?
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[filename,pathname,filterindex] = uigetfile('*.xls;*.xlsx;*.xlsm;*.xlsb', 'Multiselect', 'on');
set(handles.listboxExcelfiles,'string',filename);
% --- Executes on selection change in listbox1
function listbox1_Callback(hObject, eventdata, handles)
% Hints: contents = cellstr(get(hObject,'String')) returns listboxDatasheets contents as cell array
% contents{get(hObject,'Value')} returns selected item from listboxDatasheets
% --- Executes on button press in pushbutton2
function pushbutton2_Callback(hObject, eventdata, handles)
select_all = numel(get(handles.listboxExcelfiles,'string'));
set(handles.listboxExcelfiles,'value',1:select_all);
% --- Executes on button press in pushbutton3
function pushbutton3_Callback(hObject, eventdata, handles)
filename = get(handles.listbox1,'string'));
len = length(filename);
for j = 1 : len
[num,txt,raw] = xlsread(filename,10,'J10:J34');
set(handles.listbox2, 'string', num);
end
Also there could be overwriting in listbox2. How can i exclude value if there is a repetition in listbox2
3 件のコメント
採用された回答
その他の回答 (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!