Error when I try to update an edit text field in a GUI

1 回表示 (過去 30 日間)
Hannah D
Hannah D 2019 年 10 月 22 日
コメント済み: Adam 2019 年 10 月 22 日
I want to change the default value of an edit text field in a GUI, but when I try to update the field from the code, I get an error.
set(handles.month,'String','Does this work?');
gives me the error "Dot indexing is not supported for variables of this type."
It seems that Matlab is objecting to handles.month, but I'm not sure why. handles is passed in to the function where I am calling set() from, so it shouldn't be an issue of inability to access the variable handles. And month is the correct name of the field I'm trying to update.
I don't think my syntax is wrong, based on examples such as https://www.mathworks.com/matlabcentral/answers/18341-display-a-value-in-edit-text-in-gui
Nor does it work to try
month = handles.month
set(month,'String','Does this work?');
which gives me the same error about dot indexing.
  1 件のコメント
Adam
Adam 2019 年 10 月 22 日
Either the wrong argument is passed in where you are referring to handles or you have corrupted the handles struct in another function. Or possibly some other reason, but it seems clear that at this point in the code handles is not a struct.
Putting a breakpoint in will let you see immediately what it actually is which will help debug what has caused the problem.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by