Set the axes in B figure with a tag to look for from the GUI callback where the data is calculated.
dat_x =
dat_y =
AX = findobj('type','axes','tag','myaxes');
plot(AX,dat_x,dat_y)
.
.
.
.
. . . . . .
EDIT
If you are getting a "Vectors must be the same lengths." error, then either you have not gotten AX correctly (perhaps you found more than one axes because you didn't tag one uniquely like I showed), or w and H are different lengths. So check:
isequal(1,numel(AX))
isequal(size(w),size(H))
If AX is empty, it could be that the axes handle is hidden especially if this was a GUIDE GUI. In that case, use:
findall(0,'type','axes','tag','myaxes')
.
.
.
.
. . . . . .
EDIT #2
If the FINDALL function didn't find the axes in B GUI, then I must ask you if you remembered to put a tag in the 'tag' property of the axes when you made the figure. It looks like you just copied and pasted what I wrote without using your own tag. If you don't tag the axes, FINDALL cannot find it the way you called it. In GUIDE open up the axes property inspector and fill in a value for the 'tag' property. Then use this same value in the call to FINDALL. Let me know if it works then.
Also, just to be sure, both GUIs are open at the same time, right? You are not trying to access an axes in a figure (fig B) that isn't opened, right?
Best Answer