uicontrol does not allow 'remove' as String during component creation

1 回表示 (過去 30 日間)
Jonas
Jonas 2023 年 6 月 15 日
コメント済み: Jonas 2023 年 6 月 22 日
Dear community,
are there reserved keywords for the text-style uicontrol? I could not find a list for that but I noticed that I could not use 'remove' as String when creating the component.
I also noticed that setting it afterwards does work. Is this a bug or is it connected to how the uicontrol elements are created?
f1=figure('Position',[0 0 100 100]);
uicontrol(f1,'style','text','String','delete');
f2=figure('Position',[0 0 100 100]);
uicontrol(f2,'style','text','String','remove');
f3=figure('Position',[0 0 100 100]);
c=uicontrol(f3,'style','text');
c.String='remove';

回答 (1 件)

Sandeep Mishra
Sandeep Mishra 2023 年 6 月 20 日
Hello Jonas,
I understand that you are trying to use the 'remove' value in uicontrol but not getting the desired result.
In MATLAB, The words 'default', 'factory', and 'remove' are reserved words that will not appear in text when quoted as normal characters.
You have to use these keywords with a forward backslash character '\' like '\remove', '\default'.
You can refer to the documentation below to learn more about reserved keywords.
  1 件のコメント
Jonas
Jonas 2023 年 6 月 22 日
thanks for your response, but why is it possible if we assign the character array afterwards? there, I also use single quotes ?

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

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by