How to take comlex number from edit text into listbox in Matlab?
1 次查看(过去 30 天)
显示 更早的评论
i want to take the double number from the editText into an array(when user pressed Add button) displaying in listbox, then do some calculations
For ex:
- User enters in editText : 2 + 2i -> Add
- 0.3 -> Add
i couldnt store entries in an array..
0 个评论
回答(1 个)
Joseph Cheng
2016-3-27
编辑:Joseph Cheng
2016-3-27
Take a look at the function regexp() http://www.mathworks.com/help/matlab/ref/regexp.html and with the input like the example below you get both the real and complex return
txt = '1+2i'
regexp(txt,'\w*i*\w*','match')
however read a bit more about regexp as depending on how people type it in you get different answers.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Data Preparation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!