uimenu for labelling according to elements in a vector
    2 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Gaetano Pavone
 le 3 Fév 2020
  
    
    
    
    
    Réponse apportée : Sahithi Kanumarlapudi
    
 le 7 Fév 2020
            I have the following code:
node = [100 -50 -50 -86.6025 0 86.6025;0 86.6025 -86.6025 50 -100 50;0 0 0 200 200 200];
edge = [1 2;2 3;3 1;1 4;2 5;3 6];
type = [1; 1; 1; -1; -1; -1];
EdgeTable = table(edge,type, ...
'VariableNames',{'EndNodes','type'});
structure=graph(EdgeTable);
p=plot(structure,'XData', node(1,:), 'YData', node(2,:),'ZData',node(3,:));
p.NodeColor='black';
uicm=uicontextmenu;
set(p,'uicontextmenu',uicm);
for kk=1:size(edges,1)
uimenu(uicm,'label',int2str(type(kk)));
end
I would like to setup a uimenu such that it returns by right-clicking of the mouse on an element, its corresponding value in the vector "type". But my code doesn't meet my intent. How can I do this?
0 commentaires
Réponse acceptée
  Sahithi Kanumarlapudi
    
 le 7 Fév 2020
        Hi, 
The code you have written is for adding elements to the uicontextmenu. You could use the ‘ButtonDownFcn’ of the Line Properties to add label to the plot as you require. 
For more information on how to use this function refer to the follwing link 
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Interactive Control and Callbacks 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!

