Splitting rectangle into smaller rectangles using fractions

4 visualizaciones (últimos 30 días)
Nishee
Nishee el 13 de Nov. de 2024
Respondida: Taylor el 14 de Nov. de 2024
I am trying to write a program that prompts user to draw a rectangle then ask for a fraction to then be split up into smaller sections. Essentially writing a code to make it so I can make example problems for math students and don't have to do this (see picture) one by one in google sheets.
So far I got to code it so the user can click and draw a rectangle and drag or edit the size of the rectangle but I have no idea how to go about splitting up the rectangle into sections like in the picture above.
I'm fairly new to Matlab and super lost so any help would be appreciated!

Respuestas (1)

Taylor
Taylor el 14 de Nov. de 2024
If you have the Image Processing Toolbox, the drawrectangle function makes this fairly trivial. The rectangle ROI object it returns has a Position property that contains the x- and y-coordinates of the upper left corner of the rectangle as well as its height and width. From there you can just divide it into however many sections you like.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by