First, you state you "would now like to import them into Matlab for controller optimization". Why can't you do your controller design in Mathematica? It has all the functionality of Matlab. Typically you would convert the TransferFunction to a StateSpaceModel and use any of these controller design functions. Then you can use these connection functions to join your controller and system together. You can simulate results. Lastly, you can export the controller directly to Wolfram SystemModeler and simulate the results on a WSM model of a system. This is far greater functionality than Matlab.
HOWEVER, if you really want to go to Matlab with strings, I would suggest you use SystemModelDelay instead of the Exp[] form. The notation is easier and the conversion to what you want is more direct because Mathematica does not try to do simplification of the Exp[] terms during InputForm.
Instead of
TransferFunctionModel[{{{Exp[-3 s] (s + 1)}}, s^2 - 2 s + 1}, s]
do this instead for your derivations:
foo = TransferFunctionModel[{{{SystemsModelDelay[3] - 1}}, s + 3}, s]
bar = StringReplace[
ToString[foo // InputForm] , {"SystemsModelDelay[" ~~ Shortest[x__] ~~ "]" :>
"exp(-s * " <> x <> ")"}]
to get the string
TransferFunctionModel[{{{-1 + exp(-s * 3]}}, 3 + s}, s)
If you REALLY want to use Exp for your derivation, then you need to do an Mathematica replacement before doing your string replacement:
bar2 = StringReplace[
ToString[(foo2 /. Exp[s * x_] -> SystemsModelDelay[-x]) //
InputForm] , {"SystemsModelDelay[" ~~ Shortest[x__] ~~ "]" :>
"exp(-s * " <> x <> ")"}]
The reason for this replacement is that the internal representation of Exp[-3 * s] is actually Power[E,Times[-3,s]] which when multiplied by anything else gets simplified to 1/Exp[3 s] in InputForm. The way around this is to replace the Exp[-3 * s] with SystemsModelDelay. You need to change sign on the constant because SystemModelDelay takes a positive number for what would normally be a negative exponent. An alternative to using SystemsModelDelay and changing the sign on the constant is to make your own temporary function to replace the time delays and replace that new function in the string:
bar2 = StringReplace[
ToString[(foo2 /. Exp[s * x_] :> myExp[x]) //
InputForm] , {"myExp[" ~~ Shortest[x__] ~~ "]" :>
"exp(" <> x <> " * s)"}]
Regards,
Neil