How to display a complex number in edit in GUI?

4 次查看(过去 30 天)
As in the question, I use
set(handles.B ,'String',B );
to display a complex number in an edit, but it seems only real part are displayed. How can I display a complex number like
a+ib
in an edit box?

回答(2 个)

Doug Hull
Doug Hull 2013-11-18
Make a second edit box right next to it that only displays the imaginary part and is labeled with an i (or j if you are that type)

Abdelrahman Yousri
Abdelrahman Yousri 2020-12-28
Since B is a number type, you should make it string type so try this >> set(handles.B, 'String', ({num2str(B)}));

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by