Gui input and displaying string/char ?

Hey guys, today i just started learn about GUI in matlab so bear with me. I wanted to get input from an edit text and display it on a static text using a button, where if i click the button the input on the edit text displayed on the static text.

 採用された回答

Image Analyst
Image Analyst 2013 年 3 月 28 日

1 投票

In the button callback
% Get edit text
edit1String = get(handles.edit1, 'string');
% Display it on a static text label
set(handles.staticText, 'String', edit1String);
You might look at this framework that demonstrates all that for you. http://www.mathworks.com/matlabcentral/fileexchange/24224 You just replace the simple functions with your own code. It has all the essential things like scroll bars, push buttons, radio buttons, etc. and when you click on them they do simple things like display text saying that you clicked on them. You replace that code with useful code that does something you want.

5 件のコメント

I Made
I Made 2013 年 3 月 28 日
編集済み: I Made 2013 年 3 月 28 日
is there any good tutorial step to step to learn abut GUI? about your code i've tried that but getting some error like: ??? Attempt to reference field of non-structure array.
I Made
I Made 2013 年 3 月 28 日
編集済み: I Made 2013 年 3 月 28 日
Ok i got it now, your code works good. Just now was my mistake hehe. But i still looking for a good tutorial, i want to learn more about the GUI in matlab
Image Analyst
Image Analyst 2013 年 3 月 28 日
See Doug Hull's blog - lots of good video tutorials there. Link is at the top of this page, under Blogs.
huda farooqui
huda farooqui 2018 年 11 月 11 日
hey @imageAnalyst found you really good at MATLAB. kindly help me in this. Look i want to take a text ("sentence") from user and convert it to audio , how can i do this in GUI . when i take input from edit text as you told above. Here is my code:
function input_Callback(hObject, eventdata, handles)
text=get(handles.input,'String') %returns contents of input as text
a=[text]
and then when i call 'a' it displays this
a =
Text with properties:
String: ''
FontSize: 10
FontWeight: 'normal'
FontName: 'Helvetica'
Color: [0 0 0]
HorizontalAlignment: 'left'
Position: [0 0 0]
Units: 'data'
why am i not getting the whole sentence in 'a'??? What is the other way to do this?
Image Analyst
Image Analyst 2018 年 11 月 11 日
Search for the tag text to speech

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

その他の回答 (1 件)

Ilham Hardy
Ilham Hardy 2013 年 3 月 28 日

0 投票

Hi,
For most of the people, the Matlab's GUI editor (GUIDE) is quite annoying. But if you want to learn more about GUIDE, see the link below

1 件のコメント

Image Analyst
Image Analyst 2013 年 3 月 28 日
This will not help you learn more about GUIDE. It's for people who want to build the GUI themselves without the assistance of GUIDE. Though GUIDE has it's issues, I still think it's better than doing it myself piecemeal.

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

カテゴリ

ヘルプ センター および File ExchangeVariables についてさらに検索

タグ

質問済み:

2013 年 3 月 28 日

コメント済み:

2018 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by