如何绘制如Matlab所示的网格图形?

如何绘制如Matlab所示的网格图形?,matlab,grid,figure,Matlab,Grid,Figure,我想在上面的图中用方框中的一些字符或没有字符进行绘图。谢谢。如果您真的需要绘图,可以使用以下功能: function plotGrid(x) dims = size(x); % Get grid tick_x = linspace(0, 1, dims(2)+1); tick_y = linspace(0, 1, dims(1)+1); % Get center points pt_x = (0.5:dims(2)) / dims(2); pt_y = (0.5:dims(1)) / di


我想在上面的图中用方框中的一些字符或没有字符进行绘图。谢谢。

如果您真的需要绘图,可以使用以下功能:

function plotGrid(x)

dims = size(x);

% Get grid
tick_x = linspace(0, 1, dims(2)+1);
tick_y = linspace(0, 1, dims(1)+1);

% Get center points
pt_x = (0.5:dims(2)) / dims(2);
pt_y = (0.5:dims(1)) / dims(1);

[pt_x pt_y] = meshgrid(pt_x, pt_y);

% Plot
figure; hold on; axis off
plot([tick_x; tick_x], repmat((0:1)', 1, dims(2)+1), 'k')
plot(repmat((0:1)', 1, dims(1)+1), [tick_y; tick_y], 'k')
text(pt_x(:), pt_y(:), x(:), 'HorizontalAlignment', 'center')
例如:

>> x = num2cell(randi(10, [10 6]));
>> plotGrid(x)

如果您真的想要打印,可以使用如下函数:

function plotGrid(x)

dims = size(x);

% Get grid
tick_x = linspace(0, 1, dims(2)+1);
tick_y = linspace(0, 1, dims(1)+1);

% Get center points
pt_x = (0.5:dims(2)) / dims(2);
pt_y = (0.5:dims(1)) / dims(1);

[pt_x pt_y] = meshgrid(pt_x, pt_y);

% Plot
figure; hold on; axis off
plot([tick_x; tick_x], repmat((0:1)', 1, dims(2)+1), 'k')
plot(repmat((0:1)', 1, dims(1)+1), [tick_y; tick_y], 'k')
text(pt_x(:), pt_y(:), x(:), 'HorizontalAlignment', 'center')
例如:

>> x = num2cell(randi(10, [10 6]));
>> plotGrid(x)

在图形上显示表格数据的一种方法是使用:

数据= “U1”“U2”“U3”“U4”“U5” [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []“U85” >>uitable('Data','Data','Units','normalized','Position',[0 0 1]); 产生:


在图形上显示表格数据的一种方法是使用:

数据= “U1”“U2”“U3”“U4”“U5” [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []“U85” >>uitable('Data','Data','Units','normalized','Position',[0 0 1]); 产生:


是否需要将其作为绘图?你能改用吗?同意。当然是一个UAuth.@ B3的应用程序,考虑将注释修改成一个答案,你需要把它作为一个情节来做吗?你能改用吗?同意。绝对适用于UAuth.@ b3,考虑将注释修改为答案。