Getting data out of ButtonDownFcn example
    15 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Todd Fallesen
 am 1 Feb. 2023
  
    
    
    
    
    Kommentiert: Todd Fallesen
 am 17 Feb. 2023
            I'm trying to use some code as found on this page:
But, what I'm failing to get, no matter what I'm trying is to get the myData structure out of the functions.  I'd love to take a measurement here and pass it to a different function, but for some reason it's eluding me.
2 Kommentare
  Jan
      
      
 am 1 Feb. 2023
				
      Bearbeitet: Jan
      
      
 am 1 Feb. 2023
  
			Please post your code. The decription "but for some reason it's eluding me" does not clarify, what you are trying to do and what the problem is.
myData exists in the workspace of the callback. If you want to access it in another function, call this functions and provide myData as input argument. So "pass it to another function" should be easy.
Akzeptierte Antwort
  Rasmita
    
 am 13 Feb. 2023
        
      Bearbeitet: Rasmita
    
 am 15 Feb. 2023
  
      It is my understanding that you are trying to update the variable ‘myData’  in base workspace whenever the value of variable ‘myData’ is updated in listener.
For this you need to add following one line of code: 
assignin('base','myData',myData);
to function definition of 'updateUnits(src,evt)'.
Hope this helps!
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!