how to divide a rectangle into 5 equal parts???
1 次查看(过去 30 天)
显示 更早的评论
i have defined a rectangle using this command
rectangle('Position',[800,900,500,1000]);
- How can i divide the rectangle into 5 equal parts horizontally
- Please help me sort this out thank you in advance
0 个评论
回答(2 个)
Azzi Abdelmalek
2015-6-14
编辑:Azzi Abdelmalek
2015-6-14
n=5 % number of parts
h=rectangle('Position',[800,900,500,1000]);
pos=get(h,'position')
a=pos(3)/n
for k=1:n
hold on
new_pos=k*a
rectangle('Position',[pos(1:2) new_pos pos(4)]);
end
hold off
4 个评论
Jan
2015-6-14
编辑:Jan
2015-6-18
@Arjun: Your questions are welcome in this forum without any doubts. Of course this forum is based on questions.
But there are different kinds of answers: One type solves the problem as fast as possible, the other tries to assist you to solve the problem by your own. The later has the advantage, that you learn to solve other problems by your own in the future.
The readers can assume that you did try to solve your question by your own already. And in the majority of cases these trials are very good and match the exact question quite well. Only some typos or misunderstandings cause errors. Then posting a completely new answer will not be as useful as asking you to post, what you have tried so far and help you to fix the error.
Therefore a good question contains the required details and usually the relevant part of the code which has been created so far. See http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer.
Especially for homework questions posting complete solutions is a serious problem, because some students copy the solutions and this is cheating. I do not think, that you want to cheat. I'm convinced that your question is serious and that Azzi is eager to solve your problem. But some other users try to misuse the forum as cheap solver and do not care about showing any own effort. And I think you could learn more, if you are assisted to solve the problem by your own. See http://www.mathworks.com/matlabcentral/answers/8626-how-do-i-get-help-on-homework-questions-on-matlab-answers .
Please accept Azzis answer if it solves your problem.
@Azzi: Okay. Thanks for your reply. I will stop to ask you repeatedly.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!