I want to show my graphical output of a Matlab program in a different pre-fixed window. So, that whenever I run the program, the output should be inside this figure. I followed a tutorial on the Matlab website and the created the figure as follows:
Until here everything is fine.
Now, when I what to show some output inside this figure with figure(1)
, Imshow(A)
, the figure size and position is automatically changed, which I do not want. I get something like this:
Now my question is: How do I show the outputs in the pre-calculated position and size?
Try displaying your images with 'InitialMagnification'
set to 'fit'
:
>> figure(1); imshow( A, 'InitialMagnification', 'fit' );
If this does not work, you might try set 'Position'
of figure after showing the image.
Alternatively, you might want to consider using imagesc
with axis image
to display the images.
Suggestion:
( 0. all of the figures are already created, but without the images loaded)
- Save the position before loading the images, eg. like: PosFig1=get(,'Position')...
- Load the images etc.
- Set the figures to there old poistions, like: set((,'Position',PosFig1)
Of course, you could put the positions into some kind of structure, to make the code to look nicer and more flexibel and so on :)