Error using matlab.gra​phics.Grap​hics/set The name 'handlevisibility' is not an accessible property for an instance of class 'matlab.gr​aphics.Gra​phicsPlace​holder'.

11 vues (au cours des 30 derniers jours)
When I use the command
set(aaa.uic3(:),'handlevisibility','callback')
the error message appears:
Error using matlab.graphics.Graphics/set
The name 'handlevisibility' is not an accessible property for an instance of class 'matlab.graphics.GraphicsPlaceholder'.
Any ideas what is wrong?
  2 commentaires
Geoff Hayes
Geoff Hayes le 29 Avr 2020
Victor - what object types do the handles in the aaa.uic3 array correspond to? Perhaps at least one does not have the HandleVisibility property?
Victor Popov
Victor Popov le 30 Avr 2020
Geoff, the part of code below. Where is my error?
SkMp.uic3(1,1) = uimenu('Label','File');
SkMp.uic3(1,2) = uimenu(SkMp.uic3(1,1),...
'Label','Figure',...
'Callback','figure',...
'position',1);
SkMp.uic3(1,3) = uimenu(SkMp.uic3(1,1),...
'Label','Close',...
'Callback','skmp_close',...
'position',2);
SkMp.uic3(1,4) = uimenu(SkMp.uic3(1,1),...
'Label','Page setup',...
'Callback','pagesetupdlg',...
'position',3);
SkMp.uic3(1,5) = uimenu(SkMp.uic3(1,1),...
'Label','Print',...
'Callback','printdlg',...
'position',4);
SkMp.uic3(1,6) = uimenu(SkMp.uic3(1,1),...
'Label','Preferences',...
'position',5);
SkMp.uic3(1,7) = uimenu(SkMp.uic3(1,6),...
'Label','Default',...
'Callback','SkMp = s_preferences(SkMp,0);');
SkMp.uic3(1,7) = uimenu(SkMp.uic3(1,6),...
'Label','Plot',...
'Callback','SkMp = s_preferences(SkMp,2);');
SkMp.uic3(1,8) = uimenu(SkMp.uic3(1,6),...
'Label','Plot color',...
'Callback','SkMp = s_preferences(SkMp,3);');
SkMp.uic3(1,9) = uimenu(SkMp.uic3(1,6),...
'Label','Plot sizes',...
'Callback','SkMp = s_preferences(SkMp,4);');
SkMp.uic3(2,1) = uimenu('Label','Pos/time');
SkMp.uic3(2,2) = uimenu(SkMp.uic3(2,1),...
'Label','Display Pos/time',...
'Callback','skmp_disp_pos_time(SkMp)');
SkMp.uic3(2,3) = uimenu(SkMp.uic3(2,1),...
'Label','New Pos/time',...
'Callback',checkokstr);
SkMp.uic3(3,1) = uimenu('Label','Star');
SkMp.uic3(3,2) = uimenu(SkMp.uic3(3,1),...
'Label','Inform',...
'Callback','[SkMp,staraz,starze,starid,starmagn,thisstar] = updstrinfo(SkMp);');
SkMp.uic3(3,3) = uimenu(SkMp.uic3(3,1),'Label','Plot star spectra','Callback','plotspec');
SkMp.uic3(3,4) = uimenu(SkMp.uic3(3,1),'Label','assign star spectra','Callback','guigetspec');
SkMp.uic3(3,5) = uimenu(SkMp.uic3(3,1),'Label','Ra/decl','Callback',str0);
SkMp.uic3(3,6) = uimenu(SkMp.uic3(3,1),'Label','Azim/Zen','Callback',str1);
SkMp.uic3(4,1) = uimenu('Label','Help');
SkMp.uic3(4,2) = uimenu(SkMp.uic3(4,1),...
'Label','Help',...
'Callback','skyhelp(5)');
SkMp.uic3(4,3) = uimenu(SkMp.uic3(4,1),...
'Label','WARRANTY',...
'Callback','skyhelp(6)');
SkMp.uic3(4,4) = uimenu(SkMp.uic3(4,1),...
'Label','Copyright',...
'Callback','skyhelp(7)');
set(SkMp.uic3(:),'handlevisibility','callback') %%----- Line 167
Error using matlab.graphics.Graphics/set
The name 'handlevisibility' is not an accessible property for an instance of class 'matlab.graphics.GraphicsPlaceholder'.
Error in skymap (line 167)
set(SkMp.uic3(:),'handlevisibility','callback')

Connectez-vous pour commenter.

Réponses (2)

Tommy
Tommy le 30 Avr 2020
Similar to how
a(3) = true
fills a(1) and a(2) with false, your SkMp.uic3 (which is a 4x9 Graphics array) fills empty values with GraphicsPlaceholder objects. One option is to store your graphics objects some other way, like with a cell array, to avoid allocating space that you don't need and don't use.
Another option is to loop through the array and check whether 'HandleVisibility' is a property of each element:
for i = 1:numel(SkMp.uic3)
if isprop(SkMp.uic3(i), 'HandleVisibility')
set(SkMp.uic3(i),'handlevisibility','callback')
end
end

Walter Roberson
Walter Roberson le 30 Avr 2020
valobj = findobj(SkMp.uic3(:), 'flat', '-property', 'handlevisibility');
set(valobj, 'handlevisibility', 'callback')

Catégories

En savoir plus sur Data Type Identification dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by