How can I create a loop to duplicate a square, representing buildings, to create a grid, representing a city, in a matrix?
Mostra commenti meno recenti
I am looking to create a matrix which represents an urban city's map to test path planning algorithms where zero is a free path and 1 is an obstacle.
For example a square shape with a starting corner at (5,5) representing a building will have the following code:
MAP(5:10, 5) = 1;
MAP(10, 5:10) = 1;
MAP(10:5, 10) = 1;
MAP(10, 5:10) = 1;
How can I create a loop or similar to create multiple buildings in the matrix in a grid form with given parameters:
Starting building coordinate
Building seperation distance
Area of building
Number of buildings
Any help would be appreciated!
Many thanks
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Resizing and Reshaping Matrices in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!