%%%%%%%%%%%%%%%%%%%%%
%function ltm
% uses logToMat.exe to convert .log to .mat
function status = ltm(warn)

if ~nargin, warn = 1; end
status = 0;

d = dir('*.log');
if (length(d) == 0), 
	if (warn), 
		uiwait(msgbox('There are no *.log files here','modal')),
	end
	return
end

d = dir('*.mat');
if (length(d) > 0),
	button = [];
	status = -1;
	if (warn),
		button = questdlg('There are *.mat files here already.  Run logToMat?');
	end
	if (~strcmp(button,'Yes')), return, end
end

p = which('ltm');
[t,p] = strtok(fliplr(p),'\');
p = fliplr(p);
command = [p 'logToMat -n *.log'];
[status,result] = dos(command);
if status < 1,
	str = 'Log files converted succesfully.';
	uiwait(msgbox(str,'modal'))
else
	errorbox(result)
end