Stuart’s MATLAB Videos

Watch and Learn

Some Uses of the MATLAB Function inputname

Sometimes I need to display the name of a variable as a character array. This can help with the updating of variable names in code and automating the importing or exporting of multiple variables to data sources such as Excel. To do this I use the MATLAB function inputname in a one-line utility varToStr.

Features used in this video include:

  • Variable and function highlighting and renaming
  • Anonymous functions
  • ~ symbol to ignore function arguments

Spot this mistake: I realize that one of the examples of varToStr’s use is in fact incorrect, i.e. it serves no purpose. Can you tell which one?

Play the video in full screen mode for a better viewing experience.

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.