Commit bf422eae authored by Brad Kennedy's avatar Brad Kennedy
Browse files

Progress on adding threads per process, num_tasks from num_processors,...

Progress on adding threads per process, num_tasks from num_processors, submit_options from qsub_options, reworked sshfrommatlab code wasn't working to begin with removed rsub_sshfm, fixed logindlg
parent 6247ac86
......@@ -47,25 +47,25 @@
% Suite 330, Boston, MA 02111-1307 USA
function properties = batchconfig2propgrid(batchconfig)
num_properties = 16;
for i=1:length(batchconfig);
properties((i*num_properties)-(num_properties-1):(i*num_properties)) = [ ...
num_properties = 17;
for i=1:length(batchconfig) % 1 based indexing is awful
properties(((i-1)*num_properties+1):(i*num_properties)) = [ ...
... % basic properties...
PropertyGridField(['exec_func[',num2str(i),']'], batchconfig(i).exec_func, ...
'Type', PropertyType('char', 'row', {'ef_gen_m','ef_current_base', 'ef_sbatch', 'ef_sqsub','ef_qsub','ef_sqsub_sshfm','ef_mshpc'}), ...
'Type', PropertyType('char', 'row', {'ef_current_base', 'ef_sbatch', 'ef_sqsub'}), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['exec_func[',num2str(i),']'], ...
'Description', ['Name of the function that will execute the htb files.']) ...
'Description', 'Name of the function that will execute the htb files.') ...
PropertyGridField(['replace_string[',num2str(i),']'], batchconfig(i).replace_string, ...
'Type', PropertyType('cellstr', 'column'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['replace_string[',num2str(i),']'], ...
'Description', ['The cell array of strings to swap into the History Template script files.']) ...
'Description', 'The cell array of strings to swap into the History Template script files.') ...
PropertyGridField(['order[',num2str(i),']'], batchconfig(i).order, ...
'Type', PropertyType('denserealdouble','matrix'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['order[',num2str(i),']'], ...
'Description', ['values representing the sequence order.']) ...
'Description', 'values representing the sequence order.') ...
... % execute head...
PropertyGridField(['qsub[',num2str(i),']'], [], ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
......@@ -74,64 +74,70 @@ for i=1:length(batchconfig);
PropertyGridField(['qsub[',num2str(i),'].session_init'], batchconfig(i).session_init, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['session_init'], ...
'Description', ['Code [or file name of a text file containing code] to execute at the begining of a submission session.']) ...
'DisplayName', 'session_init', ...
'Description', 'Code [or file name of a text file containing code] to execute at the begining of a submission session.') ...
PropertyGridField(['qsub[',num2str(i),'].job_name'], batchconfig(i).job_name, ...
'Type', PropertyType('char','row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['job_name'], ...
'Description', ['Parameters for creating the job name (Batch string swap rules apply).']) ...
'DisplayName', 'job_name', ...
'Description', 'Parameters for creating the job name (Batch string swap rules apply).') ...
PropertyGridField(['qsub[',num2str(i),'].job_init'], batchconfig(i).job_init, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['job_init'], ...
'Description', ['Code [or file name of a text file containing code] to execute at the begining of a job.']) ...
'DisplayName', 'job_init', ...
'Description', 'Code [or file name of a text file containing code] to execute at the begining of a job.') ...
PropertyGridField(['qsub[',num2str(i),'].mfile_name'], batchconfig(i).mfile_name, ...
'Type', PropertyType('char','row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['mfile_name'], ...
'Description', ['Parameters for creating the .m file name (Batch string swap rules apply).']) ...
'DisplayName', 'mfile_name', ...
'Description', 'Parameters for creating the .m file name (Batch string swap rules apply).') ...
PropertyGridField(['qsub[',num2str(i),'].m_init'], batchconfig(i).m_init, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['m_init'], ...
'Description', ['Code [or file name of a text file containing code] to execute at the begining of the m file.']) ...
PropertyGridField(['qsub[',num2str(i),'].qsub_options'], batchconfig(i).qsub_options, ...
'DisplayName', 'm_init', ...
'Description', 'Code [or file name of a text file containing code] to execute at the begining of the m file.') ...
PropertyGridField(['qsub[',num2str(i),'].submit_options'], batchconfig(i).submit_options, ...
'Type', PropertyType('cellstr', 'column'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['qsub_options'], ...
'DisplayName', 'submit_options', ...
'Description', get_scheduler_options(batchconfig(i).exec_func)) ...
PropertyGridField(['qsub[',num2str(i),'].memory'], batchconfig(i).memory, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['memory'], ...
'Description', ['Amount of memory required by each process.']) ...
'DisplayName', 'memory', ...
'Description', 'Amount of memory required by each process.') ...
PropertyGridField(['qsub[',num2str(i),'].time_limit'], batchconfig(i).time_limit, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['time_limit'], ...
'Description', ['Provide a runtime limit. (elapsed, wallclock time, not summed across cpus)']) ...
'DisplayName', 'time_limit', ...
'Description', 'Provide a runtime limit. (elapsed, wallclock time, not summed across cpus)') ...
PropertyGridField(['qsub[',num2str(i),'].mpi'], batchconfig(i).mpi, ...
'Type', PropertyType('char', 'row', {'true','false'}), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['mpi'], ...
'Description', ['Whether mpi will be used or not. (default: false)']) ...
PropertyGridField(['qsub[',num2str(i),'].num_processors'], batchconfig(i).num_processors, ...
'DisplayName', 'mpi', ...
'Description', 'Whether mpi will be used or not. (default: false)') ...
PropertyGridField(['qsub[',num2str(i),'].num_tasks'], batchconfig(i).num_tasks, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['num_processors'], ...
'Description', ['Number of processors to be used for this job. (default: 1)']) ...
'DisplayName', 'num_tasks', ...
'Description', 'Number of processors to be used for this job. (default: 1)') ...
PropertyGridField(['qsub[',num2str(i),'].threads_per_task'], batchconfig(i).threads_per_task, ...
'Type', PropertyType('char', 'row'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', 'threads_per_task', ...
'Description', 'Number of processors to be used for this job. (default: 1)') ...
PropertyGridField(['qsub[',num2str(i),'].software'], batchconfig(i).software, ...
'Type', PropertyType('char', 'row', {'matlab','octave','none'}), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['software'], ...
'DisplayName', 'software', ...
'Description', ['Name of the software to used in executing the code from History file number', num2str(i)]) ...
PropertyGridField(['qsub[',num2str(i),'].program_options'], batchconfig(i).program_options, ...
'Type', PropertyType('cellstr', 'column'), ...
'Category', ['Level ',num2str(i),' - ',batchconfig(i).file_name], ...
'DisplayName', ['program_options'], ...
'Description', ['Options ???.']) ...
];
'DisplayName', 'program_options', ...
'Description', 'Options ???.') ...
];
end
end
......
......@@ -41,11 +41,12 @@ batch_config.job_name='';
batch_config.mfile_name='';
batch_config.job_init='';
batch_config.m_init='';
batch_config.qsub_options={''};
batch_config.submit_options={''};
batch_config.memory='';
batch_config.time_limit='';
batch_config.mpi='false';
batch_config.num_processors='';
batch_config.num_tasks='';
batch_config.threads_per_task='';
batch_config.software='matlab';
batch_config.program_options={''};
......@@ -54,21 +54,36 @@ nlevels=npg/4;
if nargin==1;
batchconfig=init_batch_config;
end
exec_properties = {
'session_init', ...
'job_name', ...
'mfile_name', ...
'job_init', ...
'm_init', ...
'submit_options', ...
'memory', ...
'time_limit', ...
'mpi', ...
'num_tasks', ...
'threads_per_task', ...
'software', ...
'program_options' ...
};
for li=1:nlevels;
batchconfig(li).exec_func=strtrim(propgrid.Properties((li*4)-3).Value);
batchconfig(li).replace_string=strtrim(propgrid.Properties((li*4)-2).Value);
batchconfig(li).order=propgrid.Properties((li*4)-1).Value;
batchconfig(li).session_init=strtrim(propgrid.Properties((li*4)).Children(1).Value);
batchconfig(li).job_name=strtrim(propgrid.Properties((li*4)).Children(2).Value);
batchconfig(li).job_init=strtrim(propgrid.Properties((li*4)).Children(3).Value);
batchconfig(li).mfile_name=strtrim(propgrid.Properties((li*4)).Children(4).Value);
batchconfig(li).m_init=strtrim(propgrid.Properties((li*4)).Children(5).Value);
batchconfig(li).qsub_options=strtrim(propgrid.Properties((li*4)).Children(6).Value);
batchconfig(li).memory=strtrim(propgrid.Properties((li*4)).Children(7).Value);
batchconfig(li).time_limit=strtrim(propgrid.Properties((li*4)).Children(8).Value);
batchconfig(li).mpi=strtrim(propgrid.Properties((li*4)).Children(9).Value);
batchconfig(li).num_processors=strtrim(propgrid.Properties((li*4)).Children(10).Value);
batchconfig(li).software=strtrim(propgrid.Properties((li*4)).Children(11).Value);
batchconfig(li).program_options=strtrim(propgrid.Properties((li*4)).Children(12).Value);
% Some aliases
propi = li - 1;
pp = propgrid.Properties;
ppexec_conf = propgrid.Properties(li*4);
batchconfig(li).exec_func = strtrim(pp(propi*4+1).Value);
batchconfig(li).replace_string = strtrim(pp(propi*4+2).Value);
batchconfig(li).order = pp(propi*4+3).Value;
for i = 1:length(exec_properties)
batchconfig(li).(exec_properties{i}) = ...
strtrim(ppexec_conf.Children(i).Value);
end
end
......@@ -44,32 +44,44 @@ batch_config = init_batch_config();
batch_config.exec_func='';
batch_config.software='';
keywords=fieldnames(batch_config);
keywords = fieldnames(batch_config);
% Backwards compatibility
backwards_compat = struct('qsub_options', 'submit_options', ...
'num_processors', 'num_tasks');
backwards_fields = fields(backwards_compat);
keywords = [keywords; backwards_fields];
% Open file
fileID = fopen(fname);
C = fread(fileID, '*char')';
t = config_parse(C);
fclose(fileID);
for i=1:length(keywords)
kw = keywords{i};
% Child elements
key_val = t.get_children_contents_of_match(t, ...
@(x) strcmp(x, keywords{i}), 1);
@(x) strcmp(x, kw), 1);
if isempty(key_val)
continue
end
% key_val is always a cell array
if iscell(batch_config.(keywords{i}))
batch_config.(keywords{i}) = key_val';
elseif ischar(batch_config.(keywords{i}))
% Backwards compatibility check, changes any item in backwards_compat
if isfield(backwards_compat, kw)
kw = backwards_compat.(kw);
end
if iscell(batch_config.(kw))
batch_config.(kw) = key_val';
elseif ischar(batch_config.(kw))
if numel(key_val) ~= 1
error('key_val must be one sized for %s which is a char', ...
keywords{i})
kw)
end
batch_config.(keywords{i}) = key_val{1};
elseif isnumeric(batch_config.(keywords{i}))
batch_config.(keywords{i}) = str2num(key_val{:});
batch_config.(kw) = key_val{1};
elseif isnumeric(batch_config.(kw))
batch_config.(kw) = str2num(key_val{:});
end
end
......@@ -121,14 +121,13 @@ if ~isempty(batch_config.mpi)
end
num_proc = 1;
if ~isempty(batch_config.num_processors)
num_proc = str2double(batch_config.num_processors);
if ~isempty(batch_config.num_tasks)
num_proc = str2double(batch_config.num_tasks);
end
num_thread_per_proc = 1;
if isfield(batch_config, 'num_thread_per_proc') ...
&& ~isempty(batch_config.num_thread_per_proc)
num_thread_per_proc = str2double(batch_config.num_thread_per_proc);
if ~isempty(batch_config.threads_per_task)
num_thread_per_proc = str2double(batch_config.threads_per_task);
end
program = batch_config.software;
......@@ -137,7 +136,7 @@ program_options = batch_config.program_options;
exec_str = tjob.exec_str{data_filename_index};
generic_opts = batch_config.qsub_options;
generic_opts = batch_config.submit_options;
is_octave = strcmp(program, 'octave') || strcmp(program, 'matlab');
%% Wrapper file for octave
......
% rsub_sshfs() - Submits the batch pipeline defined by job_struct structure
% created by pop_runhtb() to the SHARCNET scheduler via sshfrommatlab calls
% (given that this is being called by a Microsoft based OS [Windows]). This
% function makes use of the sshfrommatlab toolbox included in the
% "external" folder of the this plugin.
%
% Usage:
% >> job_struct=rsub_sshfm(job_struct)
%
%
% Required Inputs:
% job_struct = structure created by pop_runhtb that contains the
% combined information required to submit a batch pipeline
% to the SHARCNET scheduler.
%
% Outputs:
% job_struct = updated intput.
%
% Notes:
% This function is called to submit a batch pipeline to the SHARCNET
% scheduler when the batch_config.exec_func is set to ef_sqsub and the
% "Remote submit communication method" is set to "sshfrommatlab".
%
% See also: pop_runhtb(), ef_sqsub()
% Copyright (C) 2017 Brock University Cognitive and Affective Neuroscience Lab
%
% Code written by James A. Desjardins, Allan Campopiano, and Andrew Lofts
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program (LICENSE.txt file in the root directory); if not,
% write to the Free Software Foundation, Inc., 59 Temple Place,
% Suite 330, Boston, MA 02111-1307 USA
function job_struct=rsub_sshfm(job_struct)
% Removed Order inds
% no More order inds (1) and (2)
% job_struct(length(job_struct))
%% LOAD THE QSUB.TXT FILE...
if ~isfield(job_struct(length(job_struct)),'user_password');
if isfield(job_struct(length(job_struct)).context_config,'remote_user_name');
job_struct(length(job_struct)).user_password=logindlg('Title',[job_struct(length(job_struct)).context_config.remote_user_name,'@',job_struct(length(job_struct)).context_config.remote_exec_host],'Password','only');
else
[job_struct(length(job_struct)).context_coonfig.remote_user_name,job_struct(length(job_struct)).user_password]=logindlg('Title',job_struct(length(job_struct)).context_config.remote_exec_host);
end
end
%% INITIATE THE SSH CONNECTION...
conn=sshfrommatlab(job_struct(length(job_struct)).context_config.remote_user_name, ...
job_struct(length(job_struct)).context_config.remote_exec_host, ...
job_struct(1).user_password);
%% SFTP FROMMATLAB M FILES TO THE REMOTE LOG...
zip([fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path),'.zip'], ...
'*.*',fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path));
job_struct(length(job_struct)).remote_log=fullfile(job_struct(length(job_struct)).remote_work, ...
job_struct(length(job_struct)).context_config.log, ...
[job_struct(length(job_struct)).m_path,'.zip']);
job_struct(length(job_struct)).remote_log=strrep(job_struct(length(job_struct)).remote_log,'\','/');
sftpfrommatlab(job_struct(length(job_struct)).context_config.remote_user_name, ...
job_struct(length(job_struct)).context_config.remote_exec_host, ...
job_struct(1).user_password, ...
fullfile(cd,fullfile(job_struct(length(job_struct)).context_config.log, ...
[job_struct(length(job_struct)).m_path,'.zip'])), ...
job_struct(length(job_struct)).remote_log)
%% GET THE QSUBSTR... UPDATE TO EXECUTION OF BASH SCRIPT...
%job_struct;
unzipcom=['cd ',job_struct(length(job_struct)).remote_work,'; ', ...
'unzip ',[strrep(fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path),'\','/'),'.zip -d '], ...
strrep(fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path),'\','/'),'; ' ...
' chmod 755 ',strrep(fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path),'\','/'),'/submit.sh; ', ...
strrep(fullfile(job_struct(length(job_struct)).context_config.log,job_struct(length(job_struct)).m_path),'\','/'),'/submit.sh;'];
%% ISSUE THE SQSUBSTR...
[conn,result]=sshfrommatlabissue(conn,unzipcom);
disp(result)
%% COLLECT THE NEW JOBIDS FROM THE SCHEDULLER...
job_struct(length(job_struct)).jobids={};
for bfi=1:length(job_struct(length(job_struct)).batch_dfn);
jobidstr=strtrim(result{length(result)-length(job_struct(length(job_struct)).batch_dfn)+bfi});
sinds=strfind(jobidstr,' ');
job_struct(length(job_struct)).jobids{bfi}=jobidstr(sinds(end)+1:end);
end
%% CLOSE SSHFROMMATLAB CONNECTION...
sshfrommatlabclose(conn);
......@@ -3,12 +3,14 @@
% that this is being called by a Unix based OS [Linux or Mac]).
%
% Usage:
% >> job_struct=rsub_sys(job_struct)
% >> job_struct=rsub_sys(job_struct, driver, password)
%
% Required Inputs:
% job_struct = structure created by pop_runhtb that contains the
% combined information required to submit a batch pipeline
% to the SHARCNET scheduler.
% job_struct = structure created by pop_runhtb that contains the
% combined information required to submit a batch pipeline
% to the SHARCNET scheduler.
% driver = scheduler driver
% sshfm_opts = password for sshfm if used, and other opts
%
% Outputs:
% job_struct = updated intput.
......@@ -40,8 +42,9 @@
% write to the Free Software Foundation, Inc., 59 Temple Place,
% Suite 330, Boston, MA 02111-1307 USA
function job_struct=rsub_sys(job_struct, driver)
function job_struct=rsub_sys(job_struct, driver, sshfm_opts)
issshfm = nargin > 2 && ~isempty(sshfm_opts);
tjob = job_struct(end);
cc = tjob.context_config;
......@@ -59,13 +62,22 @@ tjob.remote_log = strrep(tjob.remote_log, '\', '/');
job_struct(end).remote_log = tjob.remote_log;
%% SECURE COPY M FILE TO REMOTE HOST...
cmdstr = sprintf('scp %s %s@%s:%s', ...
fullfile(cd, cc.log, [tjob.m_path,'.zip']), ...
cc.remote_user_name, ...
ziplocal = fullfile(cd, cc.log, [tjob.m_path,'.zip']);
if ~issshfm
cmdstr = sprintf('scp %s %s@%s:%s', ...
ziplocal, ...
cc.remote_user_name, ...
cc.remote_exec_host, ...
tjob.remote_log);
system_cmd_or_error(cmdstr, 'Failed to copy to remote');
else
% TODO(brad) this is broken
sftpfrommatlab(cc.remote_user_name, ...
cc.remote_exec_host, ...
tjob.remote_log);
system_cmd_or_error(cmdstr, 'Failed to copy to remote');
sshfm_opts.password, ...
ziplocal, ...
tjob.remote_log)
end
%% GET THE QSUBSTR... UPDATE TO EXECUTION OF BASH SCRIPT...
......@@ -74,17 +86,25 @@ long_mpath = fullfile(cc.log, tjob.m_path);
sshhost = sprintf('%s@%s', cc.remote_user_name, cc.remote_exec_host);
sys_str = ['ssh %s ''cd %s && unzip %s.zip -d %s' ...
' && rm %s.zip && chmod +x %s/submit.sh && %s/submit.sh'''];
cmdstr = sprintf(sys_str, sshhost, ...
cmd_str = ['cd %s && unzip %s.zip -d %s' ...
' && rm %s.zip && chmod +x %s/submit.sh && %s/submit.sh'];
cmd_str = sprintf(cmd_str, ...
tjob.remote_work, ...
long_mpath, long_mpath, ...
long_mpath, ...
long_mpath, ...
long_mpath);
result_str = system_cmd_or_error(cmdstr, 'Failed to submit script');
if ~issshfm
sys_str = sprintf('ssh %s ''%s''', sshhost, cmd_str);
result_str = system_cmd_or_error(sys_str, 'Failed to submit script');
else
conn = sshfrommatlab(cc.remote_user_name, ...
cc.remote_exec_host, ...
sshfm_opts.password);
[conn, result_str] = sshfrommatlabissue(conn, unzipcom);
sshfrommatlabclose(conn);
% TODO(brad) this is broken
end
%% COLLECT THE NEW JOBIDS FROM THE SCHEDULER...
......
......@@ -24,7 +24,8 @@
% Copyright (C) 2017 Brock University Cognitive and Affective Neuroscience Lab
%
% Code written by James A. Desjardins, Allan Campopiano, and Andrew Lofts
% Code written by James A. Desjardins, Allan Campopiano, Andrew Lofts,
% and Brad Kennedy
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
......@@ -256,6 +257,7 @@ end %End of solo file selected if statement
%% START BATCHING PROCEDURE...
starttime = datestr(now, 'yyyy-mm-ddTHH-MM-SS');
password_sshfm = '';
for hi=1:length(htb_fname)
%% DO FOR EACH HISTORY FILES FILE...
......@@ -296,7 +298,7 @@ for hi=1:length(htb_fname)
job_struct(hi).starttime = starttime;
job_struct(hi).exec_str = {''};
if strcmp(batch_config(hi).exec_func,'ef_current_base')
job_struct=ef_current_base(job_struct);
job_struct = ef_current_base(job_struct);
else
switch batch_config(hi).exec_func
case 'ef_sqsub'
......@@ -317,7 +319,15 @@ for hi=1:length(htb_fname)
job_struct = rsub_sys(job_struct, driver);
case 'sshfrommatlab'
disp('submitting jobs using sshfrommatlab...')
job_struct = rsub_sshfm(job_struct);
if isempty(password_sshfm)
password_sshfm = logindlg( ...
'Title', sprintf('Password for %s on %s', ...
context_config.remote_user_name, ...
context_config.remote_exec_host), ...
'Password', 'only');
end
sshfm_opts.password = password_sshfm;
job_struct = rsub_sys(job_struct, driver, sshfm_opts);
case 'none'
disp('The job files are generated ... finished.');
end
......
......@@ -30,6 +30,7 @@
% have a delay before they are converted to asterisks.
% Changelist:
% 1.4: - Brad Kennedy fixed this garbage
% 1.3: -Pressing the Escape key with focus anywhere on the dialog will
% now cancel the dialog box
% -Typo correction
......@@ -87,11 +88,11 @@ if nargin == 0
elseif nargin == 2 && ~isempty(strmatch('password',lower(varargin{1}))) && ~isempty(strmatch('only',lower(varargin{2})))
Pass = 1;
elseif nargin == 4 && ~isempty(strmatch('password',lower(varargin))) && ~isempty(strmatch('only',lower(varargin)))
P = strmatch('password',lower(varargin));
O = strmatch('only',lower(varargin));
if P == 1 && O == 2
P = strcmpi('password',varargin);
O = strcmpi('only',varargin);
if find(P, 1) == 1 && find(O, 1) == 2
Pass = 1;
elseif P == 3 && O == 4
elseif find(P, 1) == 3 && find(O, 1) == 4
Pass = 1;
end
elseif nargin == 2 && isempty(strmatch('password',lower(varargin))) == 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment