P1= coordinates of the first cliked point
P2= coordinates of the second cliked point
SLOPE= slope of the drawn line
INTER= intercept Y(X=0)
In the current figure, you have to click twice.
The GETSLOPEINTERCEPT function will display
the slope and the intercept of the drawn line in a text box
Jean-Luc Dellis (2021). getslopeintercept (https://www.mathworks.com/matlabcentral/fileexchange/23415-getslopeintercept), MATLAB Central File Exchange. Retrieved .
Merci Chibuzo, I just have update the code in simplifiing it and to comply the last Matlab releases.
I tried running the code with the current MATLAB version and it showed these error lines
Error using getslopeintercept (line 46)
Error while evaluating Figure WindowButtonMotionFcn.
Can someone help me out!
This was useful to me.Thank you
Sorry but the code processes matlab figures, not images... The easy way to handle your goal would be to use the program "GRABIT" (author:Jiro Doke). Using this great program, you would be able to produce figures from your images and then, to use "GETSLOPEINTERCEPT". Cheers.
I wish your function could be applied to gray scale images... since I'm interested in measuring slopes on such images.
When I try to use getslopeitersect I get: ??? Error using ==>
getslopeintercept at 23
There is No Curve !!
Is there an easy solution to this problem?? Thanks, a lot
greetings from argentina
Oops, i sent (26 march) the updated code... It is not still published. Please before downloading it, wait it appears corrected. You also can find it in the bottom of this page:
Thank you Matt. You were right and i have corrected the bug. It went from the kind of the output of the command
which is SCALAR when only one line exists, and which is a CELL when several lines are available.
Now, GETSLOPEINTERCEPT can work with several lines and figures as well with only one. As we say in french "on a pas des métiers faciles" indeed when i worked on this function i had allways several open figure and didnt notice the variability of the output of the command. I apologize again.
This really needs some improvement. Since there is no help of any value, I had to read a bit of the code to figure out what I was supposed to do.
??? Cell contents reference from a non-cell array object.
Error in ==> getslopeintercept at 21
Fix the code and have a look at the help for the Matlab function 'max' as an example of how to write the help for your function.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!