How to set AllowEmpty in numeric uieditfield to 'on'

조회 수: 8 (최근 30일)
Angus
Angus 2023년 11월 14일
댓글: Angus 2023년 11월 22일
Hi, I've been trying to set a placeholder on a numeric uieditfield and been unsuccessful.
According to the documentation here, I should be able to run the following code:
fig=uifigure
xlim=uieditfield(fig, 'numeric');
xlim.AllowEmpty = 'on';
xlim.Value = [];
xlim.Placeholder = 'Input x axis limits';
But this error message appears:
Unrecognized property 'AllowEmpty' for class 'matlab.ui.control.NumericEditField'.
Which is really confusing because the documentation clearly lists that as a property.
Any help is greatly appreciated. Thanks you very much.
  댓글 수: 3
Voss
Voss 2023년 11월 14일
Running OP's code in R2022a, I get the same error message OP reports.
Angus
Angus 2023년 11월 22일
Hi all, as T.Nikhil pointed out in the other thread, it may be a feature for newer versions but I'm stuck on R2022b at my company. Thanks for the help!

댓글을 달려면 로그인하십시오.

채택된 답변

T.Nikhil kumar
T.Nikhil kumar 2023년 11월 22일
Hello Angus,
I understand that you want to create a placeholder for your numeric edit field but are facing errors with it.
These features of creating a placeholder by leveraging the ‘Placeholder’ property and of allowing empty edit field using the ‘AllowEmpty’ property are additions to the latest release of MATLAB i.e R2023b. Hence, you are facing this error since these properties cannot be accessed in earlier releases.
I would suggest you update your version of MATLAB to R2023b to be able to use these properties.
Hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by