simple scriptlet in disguise; probably once a quick-and-dirty fix for a narrowly defined project (it crashes for anything more sophisticated than one line); no general use for this community at large as there are many other ways to do the same - but better; no new insights/tricks for programmers
us
Despite the author's claim, this function returns no argument. It defines the value internally, but since it is a function, with no outputs, NOTHING is returned.
This function also requires the statistics toolbox, NOT reflected in the submission comments or the documentation. Since no use is made of the other outputs of regress, polyfit would be a far better choice, since all users have that code.
I'd also like to see a better description of the behavior of this function, making it clear to the user that only data between successive mouse clicks in x is utilized. No error checks are done at all.
Too many problems.