0

在此处输入图像描述

我会在上图中绘制一些或没有字符的方框。谢谢。

4

2 回答 2

3

如果你真的想要一个情节,你可以用这样的功能来做到这一点:

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)

在此处输入图像描述

于 2012-02-02T23:35:00.267 回答
1

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

数据 =

    'U1' 'U2' 'U3' 'U4' 'U5'
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] []
      [] [] [] [] 'U85'

>> uitable('Data', data, 'Units', 'normalized', 'Position', [0 0 1 1]);

产生:

在此处输入图像描述

于 2012-02-07T00:47:50.210 回答