How to plot values inside a rectangular cell of a mesh ?

d=5;
x1=zeros(1,d)+20;
y1=linspace(4,16,d);
z1=linspace(-1,3,d)';
% Formation of mesh grid for OBJECT
[XX1,YY1]=meshgrid(x1,y1);
Yt1=YY1';
zz1=repmat(z1,1,d);
A1=mesh(XX1,Yt1,zz1);
axis([-10 50 -10 50])
VF=zeros(4,4)+0.0024;
I have created a mesh A1 using the above code.
i have another 4x4 matrix VF.I want to plot the numeric values of VF inside each rectangular cell.

댓글 수: 6

How does the (4x4) matrix relate to the plot the code creates?
The numeric values can be plotted easily enough using the text function.
d = 42; % Supply Missing Value
x1=zeros(1,d)+20;
y1=linspace(4,16,d);
z1=linspace(-1,3,d)';
% Formation of mesh grid for OBJECT
[XX1,YY1]=meshgrid(x1,y1);
Yt1=YY1';
zz1=repmat(z1,1,d);
A1=mesh(XX1,Yt1,zz1);
axis([-10 50 -10 50])
VF=zeros(4,4)+0.0024;
dx = mean(XX1,'all');
dy = mean(diff(YY1),'all');
text(XX1(:)+dx/2, YY1(:)+dy/2, zeros(size(XX1(:))), sprintf('%.4f %.4f %.4f %.4f\n',VF), 'FontSize',6)
VF=zeros(4,4)+0.0024;
view(45,25)
.
d=5;
It will create a mesh having 16 rectangular cells.
I have a VF matrix which is also 4x4.
I want to plot the values of VF inside each rectangular cell.
What I posted is likely as good as it gets.
When you say that you want to plot the values of VF, do you mean that you want to put the text number of the value in the appropriate place in the 4 x 4 square ?
Yes,exactly
I'd be curious to know what the purpose of this is, and why it is preferable to using a uitable.

댓글을 달려면 로그인하십시오.

 채택된 답변

Sivani Pentapati
Sivani Pentapati 2022년 1월 3일

0 개 추천

Hi MD,
As mentioned above, In order to display the values of a matrix across a mesh, you can used text function with an offset for each location in the grid to display the values at the center. Please refer to the attached script for a temporary workaround.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2021년 12월 25일

답변:

2022년 1월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by