Can GUI files share data?

Hello! I'm making an interface using GUI. It has to read some points and make a plot with it and, if I push a button it should move to another interface (another GUI file) and, using the same data, generate a different plot. My question is, is that possible? Can different files share a point and how do I send this point to the second file?
Sorry if it sound a bit far-fetched

Respuestas (2)

Sabarinathan Vadivelu
Sabarinathan Vadivelu el 19 de Abr. de 2013

0 votos

Yes, You can do. Declare the variables which you need to plot as global. Then you just call the other file. There you can plot.

1 comentario

María
María el 19 de Abr. de 2013
It isn't working. Where should I put the global declaration?

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 19 de Abr. de 2013

0 votos

8 comentarios

Image Analyst
Image Analyst el 19 de Abr. de 2013
If you use global variables, put the global declaration inside every function that needs to "see" that variable. For example:
global variableThatNeedsToBeShared;
Put that in sub1() and sub2() if both sub1() and sub()2 need to see it. sub3() will not see it.
María
María el 19 de Abr. de 2013
It isn't working. I'm triying the FAQ methods but it's no use.
I'm trying to read a point from GUI1 and plot a graph on GUI1 and push a button and generate a different plot on GUI2 but using the data of GUI1. I'm using this sentences, where po, pf and t are the data than I use in function posicion:
po=handles.edit1;
pf=handles.edit2;
t=handles.edit3;
handles.po=po;
handles.pf=pf;
handles.t=t;
posicion(handles.po,handles.pf,handles.t)
Image Analyst
Image Analyst el 19 de Abr. de 2013
Then just write your data out to a mat file and have the other gui read that in.
María
María el 21 de Abr. de 2013
But the data will change lots of time. You have to write data on the interface and then GUI1 does a thing and GUI2 another, but if you chage the data it has to be still working.
I'm sorry if I'm boring you or spamming this, but I am pretty sure that you are my last hope. If you want we can continue on private messages.
Image Analyst
Image Analyst el 21 de Abr. de 2013
Why complicate things by having two GUIs? Can't you build them into a single GUI?
María
María el 21 de Abr. de 2013
I've tried. On GUI1 I have a graph so I thought, when I push button1 a new graph will put on the first one and then add a close button or something like that, but the new graph never appeared and the first one only blinks once. Maybe I am not doing this on the rigth way, how should I do that?
Image Analyst
Image Analyst el 21 de Abr. de 2013
Editada: Image Analyst el 21 de Abr. de 2013
Please upload screenshots of both your GUIs to http://snag.gy. Click on your GUI to make it active. Type alt-Printscreen to capture the active window into the clipboard. Then go to snag.gy and type control-v. Repeat for your second GUI, and tell me the urls for both windows.
María
María el 22 de Abr. de 2013
This is the first GUI and in the function in the left is the one osed in button "Posición", which has a callback to "interfaz_posicion" and should do the function "posicion(po,pf,t)"
This one is with the data on GUI1
And this one is when I push button "Posicion", it opens another GUI but with no function, and the command window doesn't show any message or error

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 19 de Abr. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by