input vector fra edit text in guide GUI

1 次查看(过去 30 天)
I have used this code:
MVSENS=str2double(get(handles.edit27, 'String'))
it works fine for a single number like eg. 25, but i want to input a vector like this:
[1 2 3 4 5 6 ]
how do i do that from the edit text box in guide GUI

采纳的回答

Adam
Adam 2020-2-25
编辑:Adam 2020-2-25
sscanf( str, '%d' )
or
str2num( str )
would both work if the input is e.g. "1 2 3 4 5 6", although the first returns a column vector, but you can easily transpose it if you wish. The latter still works if you input "[1 2 3 4 5 6]" too.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by