how to pcolor all value of a matrix ?

7 views (last 30 days)
clear all
clc
a=[100 0 50; 30 5 100; 80 50 0]
b=[a ;a(end,:)] ;
b=[b b(:,end)]
subplot(1,2,1)
pcolor(a)
subplot(1,2,2)
pcolor(b)
%%
Hey guys, I tried to plot all the value of the matrix "a" by using pcolor, I expected to obtain 9 values on the graph since " a" is 3*3 Martix but Matlab skip the last row and last Column and I only obtained 2*2 value, so I tried to create a new matrix called " b" by reading the last column and row.
is their a way to pcolor all the value of "a" without skipping any data and not creating every time a new matrix?
Thank you in advance

Accepted Answer

Walter Roberson
Walter Roberson on 6 Jan 2022
No, there is no way to do that.
pcolor(a) is surf(a); view(2) and surf() creates face colors by interpolation of the four corners of the face. surf() and so pcolor() will always "lose" a row and column and there is no way to get around that.
You should be using imagesc() if you have a flat plane with equidistant faces. You should be using warp() if you need to wrap an image to a curved surface.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!