How to set AllowEmpty in numeric uieditfield to 'on'
Show older comments
Hi, I've been trying to set a placeholder on a numeric uieditfield and been unsuccessful.
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 Comments
Les Beckham
on 14 Nov 2023
Edited: Les Beckham
on 14 Nov 2023
Your code seems to work just fine; when I run it I get no error message and I get an edit field with your specified placeholder text displayed in it.
I would, however, recommend changing the name of your edit field handle variable to something other than xlim. That is a commonly used Matlab function (for changing the x axis limits of a plot).
Voss
on 14 Nov 2023
Running OP's code in R2022a, I get the same error message OP reports.
Angus
on 22 Nov 2023
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!