handles for string concatenate in GUIDE

3 ビュー (過去 30 日間)
Shawn Chang
Shawn Chang 2012 年 11 月 16 日
Hi, I am writing a function to set the string in listbox to concatenate strings vertically. It works well somehow. The problems is that the data cannot be import to workspace and show variables results at command window. The error occur when there is no ';' after each calculation code and the warning message show the error is cause by the code of this function.
function display(handles,string_text)
if isnumeric (string_text)
string_text = num2str(string_text);
end
ori_string=get(handles.lstLog,'String');
string_text=sprintf('%s',string_text);
set(handles.lstLog,'string',strvcat(ori_string,string_text));
drawnow;
Warning message: ??? Input argument "string_text" is undefined.
  1 件のコメント
Yash
Yash 2012 年 11 月 16 日
see you can display the initial numeric value in the command window as i see that you are already converting the numneric value to string for displaying it in the list box.

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

採用された回答

Jan
Jan 2012 年 11 月 16 日
編集済み: Jan 2012 年 11 月 16 日
I do not understand the question.
  • Your function sets the string to concatenate strings? What does this mean?
  • How do you try to import data to which workspace?
  • Which error occur? You've only posted a warning.
But I can guess, what might causing serious troubls:
display is an important built-in function. Shadowing it by a user-defined function is a bad idea. The function display() is called, when a code line is not terminated by a semicolon. So try to use a different name for your function.
  1 件のコメント
Shawn Chang
Shawn Chang 2012 年 11 月 16 日
Thanks Jan. The problem really cause by the naming part of the function. After the name of the function has been changed, the GUI working well.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by