MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelský manuál Strana 235

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 330
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 234
List Box Directory Reader
10-11
First input argument is not a directory, but is a character string and there is
more than one argument — execute the subfunction identified by the
argument (execute callback).
The following code listing show the setup section of the GUI M-file, which does
one the following:
Sets the list box directory to the current directory, if no directory is specified.
Changes the current directory, if a directory is specified.
function lbox2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled (see VARARGIN)
% Choose default command line output for lbox2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
if nargin == 3,
initial_dir = pwd;
elseif nargin > 4
if strcmpi(varargin{1},'dir')
if exist(varargin{2},'dir')
initial_dir = varargin{2};
else
errordlg({'Input argument must be a valid',...
'directory'},'Input Argument Error!')
return
end
else
errordlg('Unrecognized input argument',...
'Input Argument Error!');
return;
end
end
Zobrazit stránku 234
1 2 ... 230 231 232 233 234 235 236 237 238 239 240 ... 329 330

Komentáře k této Příručce

Žádné komentáře