Output of get() somehow not usable for set() for uicontrols
Mostra commenti meno recenti
I have a gui where there's a number of buttons on it that I want to disable during a loading process. Once I get a list of the children of the figure that have the 'Enable' property I run the following to get the current status of the buttons
statuses = get(objList,'Enable');
I then change all the 'Enable' values using set() and a single status (not array), this works fine
set(objList,'Enable','off');
I then let other code run, and finally reset the 'Enable' value to what they were, but this throws the error
set(objList,'Enable',statuses);
Below is the text of the error. I have played around with using set and get and I think I have found the interaction problem. Individually, each item in objList can take 'on', 'off' without problem. But since statuses is a cell array of the values, they can't handle it.
Error using matlab.ui.control.WebComponent/set
Error setting property 'Enable' of class 'UIControl':
Invalid enum value. Use one of these values: 'on' | 'off' | 'inactive'.
Example:
This runs file.
set(objList(39),'Enable','off');
But this fails for the same reason as above.
set(objList(39),'Enable',{'off'});
From my understanding of the set() function however, it should work. I have m graphics objects in objList, n (1) property values in 'Enable', and mxn values in the array statuses. What am I doing wrong?
- set(H,NameArray,ValueArray) specifies multiple property values using the cell arrays NameArray and ValueArray. To set n property values on each of m graphics objects, specify ValueArray as an m-by-n cell array, where m = length(H) and n is equal to the number of property names contained in NameArray.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Whos in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!