1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FIN DE LA FONCTION PRINCIPALE%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function OpenFile
global result
result=0
objet(1)=figure('units','pixels',...
'position',[250 250 500 500],...
'color',[0.125 0.913 0.687],...
'numbertitle','off',...
'name','Open a file',... %%% le titre de l'interface
'menubar','none',...
'tag','interface');
% Création de l'objet Uicontrol Ouvrir
objet(2)=uicontrol('style','pushbutton',...
'units','normalized',...
'position',[0.5 0.5 0.1 0.05],...
'string','Ouvrir',...
'callback',@file1,...
'tag','bouton+');
% Création de l'objet Uicontrol Text résultat
objet(3)=uicontrol('style','text',...
'units','normalized',...
'position',[0.3 0.6 0.3 0.05],...
'string','0',...
'tag','resultat');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FIN DE LA FONCTION PRINCIPALE%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DEBUT DE LA SOUS-FONCTION File1%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function file1(obj,event)
[filename1,pathname1, filterindex] = uigetfile(...
{'m(*.txt,*.doc,*.Rh)';...
'*.m'},...
'Select the file you want to visualize','MultiSelect', 'on');
if isequal(filename1,0)
disp('User selected Cancel')
else
disp(['User selected', fullfile(pathname1, filename1)])
result=fullfile(pathname1, filename1);
% Actualisation de la propriété String de l'objet Uicontrol Text résultat
set(objet(3),'string',num2str(result));
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%FIN DE LA SOUS-FONCTION file1%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
Partager