im=imread('test.jpg');
imshow(im);
improfile;
It open the imshow figure window with + cursor on it.
Left Mouse click-number of positions you want, its shows line connecting as shown in below,
When you will complete the right click on region of interest to observe the intensities distribution, click Right, it shows the last image as hown in below-
2nd Step after selection multiple position-
Then Right Click, gives result as shown below
improfile documentation read here, more detail check here Hope it Helps!