フィルターのクリア

how to display all files located in a folder using GUI matlab

9 ビュー (過去 30 日間)
SANKAR JYOTI NATH
SANKAR JYOTI NATH 2016 年 10 月 26 日
回答済み: Jan 2016 年 10 月 26 日
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global data;
global file_path;
global textarray;
files='C:\Users\Parag\Desktop\newfof2';
file_path=fullfile(files,'.txt');
data = dir(files);
length=2;
for k=1:length(data)
baseFileName = data(k).rawdata;
fullFileName = fullfile(files, baseFileName);
textarray=textread(fullFileName);
end
set(handles.Display,'String',textarray);
this is my code
  3 件のコメント
SANKAR JYOTI NATH
SANKAR JYOTI NATH 2016 年 10 月 26 日
i am unable to display my folder contents
Adam
Adam 2016 年 10 月 26 日
Yes, but why? You posted some code. It presumably does something, but since it uses global variables parachuted into the workspace and I don't have the ability to run it I'm not going to go through each line to work out what it does and doesn't do and where the problem may or may not be.
Do you get an error? Do you get no result? Do you get just some files?

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

回答 (1 件)

Jan
Jan 2016 年 10 月 26 日
files = 'C:\Users\Parag\Desktop\newfof2';
file_path = fullfile(files, '*.txt'); % Add: *
data = dir(files);
Currently you are looking for the file 'C:\Users\Parag\Desktop\newfof2\.txt', but I guess, that you want a list of files with the extension '.txt'.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by