Averaging Matrix and store it in a new matrix
2 次查看(过去 30 天)
显示 更早的评论
This is my coding for the result. I want to show my result as the raster data cell that showed in picture 1. Any idea how to do so?
4 个评论
采纳的回答
KSSV
2020-5-16
A = rand(10) ;
[m,n] = size(A) ;
[X,Y] = meshgrid(linspace(0.5,(m-0.5),m),linspace(0.5,(n-0.5),n)) ;
t = A(:) ;
pcolor(A) ;
hold on
text(X(:),Y(:),num2str(t),'color','w')
4 个评论
Rik
2020-5-17
Then you should flip the order of Y. You can either modify the linspace call, or use flipud. The reason for this is that the convention for image is that the origin of the coordinates is the upper left corner, not the lower left.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!