I have created a background with rectangles generated at random using rectangle constructor. On top of it, I need to place images randomly. How should I proceed? If I use separate figures,then it opens as two dialog box. Help me to resolve this problem.
Asked
Active
Viewed 33 times
0
-
1Welcome to SO. To improve your question please provide a *minimal* code example that highlights your problem (http://stackoverflow.com/help/mcve). For problems with graphical output (e.g. plotting) it often helps if you post the figure that you have so far, or (if available) an example of what you would like to achieve. – hitzg Mar 12 '15 at 08:52
-
The windows you create in matlab are called figures, so different figures will always give different windows. What the images are placed inside in the figure is called an axes object (see: http://se.mathworks.com/help/matlab/ref/axes.html). So either have more than one axes object in the figure or have more than one image in the axes object, both are possible, and both have their own advantages. So without more information this is as good an answer I can give, – Jens Boldsen Mar 12 '15 at 08:56
-
Possible duplicate of http://stackoverflow.com/questions/17362618/disallow-matlab-to-take-focus-automatically – patrik Mar 12 '15 at 08:58
1 Answers
1
Assuming that you already have your images obtained using something like:
img = imread('drawing.png');
You can plot images at certain places using certain sizes by repeated use of image(...):
image('CData', img, 'XData', [10 50],'YData', [20 50]);
image('CData', img, 'XData', [100 50],'YData', [200 50]);

CShor
- 33
- 5
-
-
Hi, these are the built-in controls for the ccordinate system of an image object. In the given example Xdata sets the x position of the outermost left column of the image at 10 and the outermost right column at 50. Similar Ydata sets the top column at 200 and the bottom column at 50. You may play with the values to see how it works. – CShor Mar 18 '15 at 17:01