How to save an axes into an matlab figure after plotting through button down function?
    5 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Vinothkumar Sethurasu
 il 11 Giu 2021
  
    
    
    
    
    Commentato: Vinothkumar Sethurasu
 il 14 Giu 2021
            I have an application to save an axes data into matlab figure after ploting some data into axes.
The action need to be done through axes button down function.
But, the button down fuction is not working after ploting the data into the axes.
10 Commenti
  dpb
      
      
 il 13 Giu 2021
				But we don't have that code to look at so still can't diagnose anything at all without spending our time trying to recreate your symptoms.  "Help us help you..."
Risposta accettata
  Adam Danz
    
      
 il 13 Giu 2021
        
      Modificato: Adam Danz
    
      
 il 13 Giu 2021
  
      I created a GUIDE-based GUI containing the two functions you mentioned and was able to reproduce the problem (in the future, you should create a simple example demo to make it easy for people to reproduce and diagnose the problem).  
When objects are plotted to the axes, the ButtonDownFcn is cleared which is why the ButtonDownFcn worked before plotting but didn't work after plotting. 
To fix it, hold the axes before plotting.
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
hold(hObject, 'on') % <--------  ADD THIS --------------------
plot(hObject, [0 20],[50 1500]); 
Another solution would be to programmatically assign the ButtonDownFcn after the plotting.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


