InquilineKea
InquilineKea

Reputation: 891

Convert variable name to string in Matlab?

So say I have variables with variable names like SWCF and LWCF. Is there a way that I can convert these variable names into strings? I'd like to do this so that I can run functions on the variables - and have the plot titles include the variable name.

Upvotes: 0

Views: 12554

Answers (1)

bla
bla

Reputation: 26069

their names are already of class char. For example if you clear all and dont have any variable in memory:

 SWCF = rand(10)
 a = whos
 a(1).name

so you can use title(a(1).name) in your plot etc...

Upvotes: 1

Related Questions