This should copy a figure window and all the objects in it to the first one and resized to fit both.
This is a little cleaner than managing two figure windows, but it may not be best thing to do if you want to do further processing on either figure.
I'd expect issues if you're using two different colormaps.
Michael Katz (2019). Compare Two Figures side by side (https://www.mathworks.com/matlabcentral/fileexchange/21998-compare-two-figures-side-by-side), MATLAB Central File Exchange. Retrieved .
How can I save the combined figure.
Updated comment: I realize now this script assumes that each of the original figures is in the desired position, as the scrip then looks up this position in order to copy over. So now it works fine. However, it strips off the legend from the second plot.
This does not work for me. The images overlap each other are are not properly displayed. Perhaps a version issue...? I'm using
MATLAB Version 18.104.22.1687 (R2007a)
Can I know how can I define fig1 and fig2?
I already plot two graph by using imagesc() function, but I don't know how to put it in the code?
I'm really new to Matlab. Please help me. Thanks.