Prev: block processing problem
Next: Curve matching question
From: Matt Fig on 23 May 2010 11:43 What do you mean, "If the axes in lulu and gugu are not the same"? Are you talking about their limits or their labels or their colors or their grid status or what? If you are talking about something which has a handle, like the xlabel, ylabel, and title, you can simply add a line in the code I gave you for each subplot: P = subplot(1,2,2); T = get(gu_ax,{'title';'xlabel';'ylabel'}); % Get the title, xlabel and ylabel. copyobj([get(gu_ax,'children');[T{:}]'],P) Now any other properties you want copied, you could do like this: C = {'xlim';'ylim';'color'}; % Cell of properties to copy set(P,C,get(gu_ax,C)) % And likewise for lu_ax etc.
From: Matt Fig on 23 May 2010 11:57 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)
From: Ziv on 23 May 2010 17:17 Hi, thanks again for the prompt response, now it looks a lot better and i think by this progress i have much better understanding of how these "families" should be handled ) so any gaps will be fixed soon. thanks a lot! ZiV
From: Ziv on 24 May 2010 11:50 Hi, if you already took the time to write this code, i'd appreciate the opportunity to learn from you since you seem to know your way around Matlab very well. can you please explain the line: copyobj([get(gu_ax,'children');[T{:}]'],P) how does [T{:}]' interperted? thanks, ZiV
From: us on 24 May 2010 12:05
"Ziv " <ziv.yekutieli(a)hotmail.com> wrote in message <hte781$oo5$1(a)fred.mathworks.com>... > Hi, if you already took the time to write this code, i'd appreciate the opportunity to learn from you since you seem to know your way around Matlab very well. can you please explain the line: > > copyobj([get(gu_ax,'children');[T{:}]'],P) > > how does [T{:}]' interperted? > > thanks, > ZiV typical syntax to turn a CELL array of numbers into a COL vec t={10,1:5} [t{:}].' %{ % ans = 10 1 2 3 4 5 %} us |