Multiple lines in an Edit Text space...

Hi everybody! In my interface I have an Edit Text set as "'Enable', 'inactive'" and I want to use it like a "display" to show my statistics... When I insert variables (even if they're arrays), there's a kind of error that says me that's impossible to show multiple lines in an edit text...
I already set a msgbox using "sprintf" function... As you might know, msgbox is structured as
var=msgbox('Text', 'Title')
I set it as
var=msgbox(sprintf('Text\ntext...'), 'Title');
and it works so well!
I tried and failed using
sprintf(handles.edit_text, 'Text');
because the structure of sprintf is
str = sprintf(format, A, ...)
__________________________________________________
Please note that I don't need to use sprintf, but I have to put multiline variables in an Edit Text as I said before... I need to use it like a display, to show arrays, or variables, or everything I'm going to calculate in the gui...
There's the possibility to use the same function or a similar way to show statistics in my Edit Text??

 採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 16 日

0 投票

Hi,
Maybe this is what you mean :
var = msgbox(get(handles.edit_text,'string'),'Title');
And don't forget to set property of the edit textbox 'min' = 1 and 'max' = 2

4 件のコメント

Jethro
Jethro 2012 年 1 月 16 日
Uhm, I think your code takes something in an edit text and put it in a msgbox...
I need to make analysis and put results in an inactive edit text...
Simple example:
for i=1:26
num(i)=[('A'-1)+i]
end
my result is
num =
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Now I have to put "num" in my edit text... How can I do???
Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 16 日
Hi, I write this is my pushbutton callback and it succesfully shown 'num' in edit textbox
num = [65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90];
num = num';
set(handles.edit1,'string',num2str(num));
Jethro
Jethro 2012 年 1 月 16 日
Chandra, if you can read it, I wrote a msg to you about something else :)
Jethro
Jethro 2012 年 1 月 16 日
IT WORKS WITH NUM2STR NOW!! xD Thanks Chandra!!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 1 月 16 日

0 投票

You have to set the "maximum" property of the edit textbox to be 2, or something greater than 1 anyway.
set(handles.editText1, 'maximum', 2);
Give that a try and see if it works.

1 件のコメント

Jethro
Jethro 2012 年 1 月 16 日
I set it in the Inspector Proprieties, in effect it was set to 1 o.O Thanks a lot!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by