How to represent each grid numerically?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
KALYAN ACHARJYA
le 8 Nov 2019
Can you more specific please?
Are you looking for insert number inside the grid elements?
Réponses (1)
Adam Danz
le 8 Nov 2019
Modifié(e) : Adam Danz
le 13 Nov 2019
% 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 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!