- It cannot convert the character vector to a scalar number.
- The value is NaN, blank, or a complex number.
- The value is a mathematical expression, such as 1 + 2.
- The value is less than the Limits property lower limit or greater than the upper limit.
How do i take complex number inputs in matlab appdesigner?
3 次查看(过去 30 天)
显示 更早的评论
I have to take both real and complex number inputs in appdesigner. I tried using Edit FIeld (Numeric) but it wont take complex inputs. Need something to take complex or real numbersas input
0 个评论
回答(1 个)
Voss
2022-2-12
MATLAB rejects the value if:
But you can use an EditField (not Numeric), in which case the Value will be a string or character vector, which you can convert to a number using str2double() (or str2num() if you need to allow non-scalars). For example:
str = app.my_edit_field.Value; % say str is '1+1i'
num = str2double(str); % then num is 1+1i
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!