MATLAB: How to make the figure created by the plot function be an object

curve fittingplot

I would like to get a variable out of the plot function so that I can use it for the rest of the code. In other words, I need what's in the figure to be an object I can edit. For example, I have drawn some pixels as points on an image using plot().
The question is how can I fit these points to get the desired curve without making these points as one object on a separate figure?

Best Answer

  • h = plot( ... )
    will return a handle to the object that is plotted, although the data in this will be the same as you gave it in the first place in terms of curve fitting.