function [success, val] = checkTf(str, name)
% checkTf
%   checkTf checks if the string is a valid tf

%   Project: IMPACT
%   Title of Code: checkTf
%   Relevant additional documentation:
%   Developer: Carlos Gonzalez
%   External Dependencies: NA
%
%   Disclaimer
%   CAUTION: It is strongly recommended that changes to this code
%   should be avoided without first consulting with authors.

% 

success = 0;
val = [];
s = tf('s');
try val = eval(str);
catch
    errordlgMLS(sprintf('Incorrect form of %s', name));
    return;
end

if ~isa(val, 'tf')&&~isa(val, 'zpk')&&~isa(val, 'ss')
    errordlgMLS(sprintf('Incorrect form of %s', name));
    return;
end
if ~isreal(val)
    errordlgMLS(sprintf('Complex model for %s', name));
    return;
end

success = 1;

