Array of string cells and guide 'string'

1 回表示 (過去 30 日間)
Leor Greenberger
Leor Greenberger 2011 年 10 月 4 日
I have in a GUIDE generated GUI several places where the user can enter data. This data is validated when the person clicks on a pushb button. Part of that validation is to check if the value makes sense and if not, to output an error message to a listbox in the figure.
So what I have done is:
error_msg = {''};
and I add error messages by doing
error_msg(end+1) = {'Error: something....'};
In the end, I do:
error_msg = error_msg(2:end)';
set(handles.status_text,'String', error_msg, 'Value', length(error_msg));
I was wondering if there is a better way to do this?

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 4 日
I don't see a better way. A slightly different way is:
error_msg=[];
error_msg=[error_msg;{'Error: something....'}];
set(handles.status_text,'String', error_msg, 'Value', length(error_msg))

その他の回答 (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