how to plot a 10*10 grid map and how to number the grid cells? (sample pic is attached here)
古いコメントを表示
Guys, I am in learning phase of matlab. I don't know how to plot this type of grid? i knew plotting simple grids, but this one made me mad. Is it possible to make this kind of one? I attached the model of the grid. thanks guys

採用された回答
その他の回答 (2 件)
Michael Haderlein
2014 年 9 月 15 日
I don't know what you mean with "plot this grid". Maybe something like this?
grid=reshape(0:99,10,10)';
figure, surf(grid)
2 件のコメント
dinesh tce
2014 年 9 月 18 日
ANDREA DI MARTINO
2021 年 11 月 4 日
Hi, how I can create an undirected graph with grid=reshape(0:99,10,10)';?
I need to create a grid graph 10x10 with undirected edges.
Joseph Cheng
2014 年 9 月 18 日
編集済み: Joseph Cheng
2014 年 9 月 18 日
you can use the text() to insert the grid labeling. here is an example. this is for labeling 1x1 pixels but it is scalable for larger grid sizes.
%something in the background
I = magic(10)
%generate where each text will go
[X Y]=meshgrid(1:10,1:10);
%create the list of text
string = mat2cell(num2str([1:10*10]'),ones(10*10,1));
%display the background
imagesc(I)
hold on
%insert the labels
text(Y(:)-.5,X(:)+.25,string,'HorizontalAlignment','left')
%calculte the grid lines
grid = .5:1:10.5;
grid1 = [grid;grid];
grid2 = repmat([.5;10.5],1,length(grid))
%plot the grid lines
plot(grid1,grid2,'k')
plot(grid2,grid1,'k')
4 件のコメント
Adam
2014 年 9 月 18 日
preferably don't call your variable 'grid' though even though in this case you are unlikely to want to use the grid function.
Joseph Cheng
2014 年 9 月 18 日
true... i wrote it up in a couple of min. wasn't really thinking when i did it.
Youssef Khmou
2014 年 9 月 18 日
That is an efficient technique to generate a figure .
dinesh tce
2014 年 9 月 21 日
カテゴリ
ヘルプ センター および File Exchange で Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
