how to convert a variable to string in matlab? -
this question has answer here:
- print variable-name in matlab 5 answers
i have structure array
some_struct_var=struct( 'filed1', filed1, 'filed2', filed2 ,...)
i want create string
str=['the struct variable name :' , some_struct_var]
with name of structure variable in it. some_struct_var may vary , not fixed.
create function takes variable input , returns string equivalent of variable's name ouput so:
vartostr = @(x) inputname(1); structvarstring = vartostr(some_struct_var) str = ['the struct variable name :', structvarstring]
Comments
Post a Comment