Send data to a different fig. window
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone,
I made two fig. windows by Matlab GUIDE. A fig. window receives all datas and calculate them then, I want to send the result of calculation to B fig. window in order to plot the result.
I have tried many ways but all failed. Please help me to solve this problem. I want to either send the data to B fig.window or read input datas in A fig.window at B window when I open it.
Thanks.
0 Kommentare
Akzeptierte Antwort
Matt Fig
am 15 Feb. 2011
Set the axes in B figure with a tag to look for from the GUI callback where the data is calculated.
% Inside callback where data is made in A GUI.
dat_x = %%%Some calculation
dat_y = %%Some calculation
AX = findobj('type','axes','tag','myaxes'); % AX in in B GUI.
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')% Use the tag you gave.
.
.
.
.
. . . . . .
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?
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!