uigetfile multiple files into the listbox

2 ビュー (過去 30 日間)
Alok Pathak
Alok Pathak 2013 年 9 月 26 日
コメント済み: Alok Pathak 2013 年 9 月 27 日
Hi Friends. I am designing a simple GUI, which has a listbox and a pushbutton.
- The Pushbutton allows the user to select multiple files. I use uigetfile. I can run this step pretty well. My code here is :
if true
%code
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.edit1, 'Max', 10);
set(handles.edit1, 'Min', 0);
[FileName, PathName] = uigetfile('*.m','Select the MATLAB code file', 'MultiSelect' , 'on');
set(handles.edit1,'String',{PathName FileName})
display(FileName(1))
display(FileName(2))
display(PathName)
end
- Next I want to display the names of all the files selected, into the very same listbox. I am not bale to achieve that. I get this error
Please help me achieve the next step.
Regards Alok
  1 件のコメント
Jan
Jan 2013 年 9 月 26 日
編集済み: Jan 2013 年 9 月 26 日
You get which error and where?

サインインしてコメントする。

採用された回答

Jan
Jan 2013 年 9 月 26 日
編集済み: Jan 2013 年 9 月 26 日
File = strcat(PathName, FileName);
set(handles.edit1, 'String', File);
Your code {PathName FileName} does the following:
  1. FileName is a {n x 1} cell string (or {1 x n}?)
  2. PathName is a string.
  3. {PathName FileName} is a cell, which contains a string in the first cell and a cell string in the second one. But you want a cell string with concatenated string.
  1 件のコメント
Alok Pathak
Alok Pathak 2013 年 9 月 27 日
Thank you very much Jan. It was a silly mistake, as I see it now. I used File as u suggested and now its fine.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by