Quantcast
Channel: MATLAB Central Newsreader - merging existing .fig into the same figure
Viewing all articles
Browse latest Browse all 15

Re: merging existing .fig into the same figure

$
0
0
I just created an account to thank for this solution: Thank you.

"Matt Fig" wrote in message <htbj8f$7kv$1@fred.mathworks.com>...
> I don't know why I didn't think of it before, but this should completely copy everything:
>
> % Open old figures.
> gu = open('gugu.fig');
> gu_ax = gca;
> lu = open('lulu.fig');
> lu_ax = gca;
>
>
>
> F = figure; % New figure
> P1 = subplot(1,2,1); % Plot a subplot.
> P1_pos = get(P1,'position'); % get its position.
> delete(P1) % Delete the subplot
> P2 = subplot(1,2,2);
> P2_pos = get(P2,'position');
> delete(P2);
> P = copyobj(gu_ax,F); % Copy the gu_ax to new fig
> set(P,'position',P2_pos) % Set its position to the deleted subplot's position, duh!
> P = copyobj(lu_ax,F);
> set(P,'position',P1_pos)

Viewing all articles
Browse latest Browse all 15

Trending Articles