# How to represent each grid numerically?

1 ビュー (過去 30 日間)
Richa Sarmah 2019 年 11 月 8 日
Edited: Adam Danz 2019 年 11 月 13 日
I have made square grids in the entire MATLAB workspace having 0.5 spacing. How can i represent those grids in number? Counting must start from 1 and in increasing order from bottom left to right and then go to upper line respectively

#### 2 件のコメント

KALYAN ACHARJYA 2019 年 11 月 8 日
Are you looking for insert number inside the grid elements?
Richa Sarmah 2019 年 11 月 8 日
I don"t want to display numbers inside the grid, instead a serially increasing number is to be assigned to each grid and that number is to be stored in veriable or matrix form.

サインイン to comment.

### 件の回答 (1)

Adam Danz 2019 年 11 月 8 日

% Inputs
xrng = [0,9]; % [left, right] bound of x axis
yrng = [0,8]; % [lower, upper] bound of y axis
gridInt = 0.5; % grid spacing
% Compute the rest
nBlocks = floor([diff(xrng), diff(yrng)] ./ gridInt); % number of complete grid squares for [x,y] axes
gridNumbers = flipud(reshape(1:prod(nBlocks), nBlocks)');
gridNumbers is a matrix of grid block counts starting at the bottom, left corner and increasing rightward then upward.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by