How to display a complex number in edit in GUI?

4 vues (au cours des 30 derniers jours)
Yizhi
Yizhi le 18 Nov 2013
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?

Réponses (2)

Doug Hull
Doug Hull le 18 Nov 2013
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 le 28 Déc 2020
Since B is a number type, you should make it string type so try this >> set(handles.B, 'String', ({num2str(B)}));

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by