How to work with 'multiselect' in uigetfile option in GUI????

8 ビュー (過去 30 日間)
sonu
sonu 2017 年 12 月 19 日
編集済み: sonu 2017 年 12 月 19 日
Hello, Please help me to show this issue,Kindly Tell where I done a mistakes.
1.how to select ONLY TWO TEXT files(appleconfig.txt,nokiaData.txt) from multiselect option & how to verify it from user prespective weather it is uploaded or not
2.how to check data is there in (appleconfig.txt,nokiaData.txt),or file is empty
3.instead of selecting two files from 'multiselect option',if user selects one text file(appleconfig.txt),how to make user to upload another correct file(nokiaData.txt)
4.how to check both appleconfig.txt,nokiaData.txt is uploaded correctly or not by clicking on abc Pushbutton
5.how can I verify that data from appleconfig.txt,nokiaData.txt is uploaded correctly or not,
6.how to display error message,when user selected other files rather than appleconfig.txt,nokiaData.txt.
My code is:
%% I tried to open the file selector using abc push button and upload the file
function abc_callback (hobject,eventdata,handles)
msg = sprintf('upload file to PFM:\n appleconfig.txt,\n nokiaData.txt\n%s');
uiwait(msgbox(msg));
[filename1 pathname1]=uigetfile({'*.txt},'FILE SELECTOR','Multiselect','on')
if isequal(filename1,0)
msg = sprintf('user selected cancel');
uiwait(msgbox(msg));
else disp(['user selected'fullfile(pathname1,filename1)])
end
%% here I tried to open the file which is uploaded
fullpathname1 =strcat(pathname1,filename1);
fid1 =fopen(fullpathname1,'r','ieee-be','US-ASCII');
fid1 = fopen(fullpathname1)
if isempty(fid1)
disp('the file is empty \n,please verify the file')
else
msg = sprintf('you can upload the file');
uiwait(msgbox(msg))
end
text = fileread('fullpathname')
a = appleconfig.txt,nokiadata.txt
if strcmp(a,filename1)==1
msg =sprintf('file upload successfully:\n%s',filename1)
uiwait(msgbox(msg));
else
warnmsg=sprintf('warning:Invalid file is selected %s',filename1);
uiwait(msgbox(warnmsg));
end

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by