Stuart’s MATLAB Videos

Watch and Learn

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Using image to view data instead of surf and view(2). 2

Posted by Doug Hull,

This video outlines a common error made with MATLAB, and how to avoid it. Often people will use the programming pattern of: surf(Z); view(2) This really does something very similar to: imagesc(Z)

2 CommentsOldest to Newest

Rodrigo replied on : 1 of 2
I noticed the indexing changed from surf to imagesc. How do the actual indices of the matrix (row,col) relate to each? Is there a way to keep that equal? Also how does pcolor perform when compared to imagesc (i.e does it also waste memory)? thanks
dhull replied on : 2 of 2
@rodrigo The indexing is different by default for two different use cases. You can override them by passing in a vector with the matrix to represent the x and y vectors. If you edit pcolor.m, you will see it uses surface underneath to accomplish its goals. doug

Add A Comment

Your email address will not be published. Required fields are marked *

Preview: hide