retrieving string from edit box

1 回表示 (過去 30 日間)
Peter
Peter 2014 年 2 月 3 日
コメント済み: Walter Roberson 2014 年 2 月 3 日
Hi, I am using a uicontrol edit box and would like to retreive the inoutted string. The code I have used is
function Save(hObject,eventdata,handles)
Name = get(name,'String');
save('name', 'Name');
which saves it to a .mat file. This only give me a number and when trying to convert it to a character using char() I get an empty space. Does anyone have any ideas what I could do? Thanks!
  2 件のコメント
Niklas Nylén
Niklas Nylén 2014 年 2 月 3 日
編集済み: Niklas Nylén 2014 年 2 月 3 日
First of all you should avoid using the same name for a built-in function, "save" in this case, as a function name. It is also very confusing that your mat file, variable and edit box are all called "name" or "Name". The issue could be that what is saved to the mat file is the handle (a number) of your edit box rather than the string due to them sharing name.
If you remove the semicolon after the get statement, what is printed in the command window?
Walter Roberson
Walter Roberson 2014 年 2 月 3 日
What is "name" defined as for the above code?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by