MATLAB: How do i convert a sentence of string numbers into multiple doubles

convertdoubleMATLABstringstransfer function

Hello guys! Im kinda new with using the GUI for MATLAB, and I have a school project which needs a GUI that accepts transfer functions and plot their unit step plot (impulse(cs,rs)), to verify their Kp, Kv, Ka.
I'm trying to a GUI that accepts a transfer function but i dont know how to implement it. I decided that i'll use an editbox to input the numeric values for the transfer function's num and denom, using this:
x = str2double(get(handles.edit1, 'string'));
y = str2double(get(handles.edit2, 'string'));
set(handles.text2, 'string', x)
sys1=tf([x],poly([y]))
so far it accepts only one number in the numerator and denominator i wanted to be able to input something like this:
>> sys1=tf([20 20],poly([-4 -3]))
sys1 =
20 s + 20
--------------
s^2 + 7 s + 12

Best Answer

You configured edit3 to have Max that is greater than 1, and the user entered more than one line.
The user did not just enter spaces between the numbers: they would have had to press return between numbers for this to have happened... and it cannot happen if Max is at its default 1.
(Exception: if you initialized edit3 String property to multiple cell entries, then if Max was set to 1, then it would have given a warning and refused to render the box for the control, but getting its String property would have returned the multiple cell entries. This is the exception to the rule that Max must have been greater than 1 and the user entered multiple lines -- the case where you yourself initialized the control that way.)
Related Question