MATLAB: What’s the difference between imagesc and imshow

imagescimshow

Hi,
When I want to display an image in figure screen, both works the same way. I was wondering what's the difference between both imagesc and imshow commands?
Thank you.

Best Answer

imshow has a number of default settings intended for displaying images, such as turning off the axes and locking the aspect ratio, that imagesc does not. imshow also had additional options for customizing how you view the image that are not available or not as easily doable through imagesc. You can see the basic differences by doing something like the following and looking at the two figures side by side.
>> imagesc(myimage)
>> figure
>> imshow(myimage)
You can get full details on the functions and their usages through their documentation pages.
>> doc imagesc
>> doc imshow
Finally you can view the source code for both if interested.
>> edit imagesc
>> edit imshow