How do I view the function workspace?
    57 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Adwait
      
 le 18 Juin 2014
  
    
    
    
    
    Commenté : Image Analyst
      
      
 le 18 Nov 2021
            I have several functions in my script. When I run the script, the variables do not show up in the base workspace. I don't know how to view the function workspace, hence I can't see the values of my function variables.
3 commentaires
  Walter Roberson
      
      
 le 3 Juin 2016
				global variables are accessible only in routines that also declare the variable to be global.
Réponse acceptée
  Sean de Wolski
      
      
 le 18 Juin 2014
        Your answer with the breakpoints is the best one. Another way would be to use the whos command inside of the function:
whos
0 commentaires
Plus de réponses (1)
  Image Analyst
      
      
 le 18 Juin 2014
        Put this command as a line in your script or function
workspace;
5 commentaires
  Jeff Bull
 le 18 Nov 2021
				Having the same issue but adding workspace; to the .m file did not work. still cannot see the variables of the function from the command line.
  Image Analyst
      
      
 le 18 Nov 2021
				@Jeff Bull, do you see the workspace panel?  If it was not up, then calling worskapce should show it.  And it should show the current values of the variables.  If it can't show them all in the workspace, you can double click on the variable name in the workspace to bring it up in the variable editor where you'll be able to see more values of it.
If you set a breakpoint on the line where you call your function you should see in values of the input arguments both in the workspace panel, and in a popup when you hover your cursor over the variables in the source code panel.  Are you saying that neither of these methods display the values?  Worst vase you can double click the variable name (to select it) and type F9 to show it in the command window, or you can just type the name on the command line.
Voir également
Catégories
				En savoir plus sur Workspace Variables and MAT Files dans Help Center et File Exchange
			
	Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







