-1

Some (graphics) objects in Matlab seem to have "names". For example, if I create a plot plot(1,1) and give it a title title('mytitle') and then access the current axes via gca I get the following answer:

ans = 

  Axes (mytitle) with properties:

             XLim: [0 2]
             YLim: [0 2]
           XScale: 'linear'
           YScale: 'linear'
    GridLineStyle: '-'
         Position: [0.1300 0.1100 0.7750 0.8150]
            Units: 'normalized'

  Show all properties

You can see that in parentheses we have "mytitle". How can I access this string?

I know that in this case, I could just get the title string, but I want to know how to generally access this name.

I'm running Matlab R2016a

1 Answer 1

0

Clicking the "Show all properties" (or calling get(gca)) you get a complete list of all properties of the current axes. The "Title" property is what your looking for.

Calling t = get(gca,'Title') you'll get all properties of the Title object, and you can access the string by calling t.String.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .