Borrar filtros
Borrar filtros

Passing a matrix between App Designer Apps

9 visualizaciones (últimos 30 días)
Kylen
Kylen el 21 de Nov. de 2023
Comentada: Kylen el 22 de Nov. de 2023
Hello Everyone,
I am quite new to both Matlab and the App Designer. For context, I'm building a data cleanup tool. Currently I have a script that runs a few different commands (sorting data, plotting, outlier deletion, etc.). My goal is to create an app that breaks these functions up into user friendly steps with some customization options. In order to do this I'll need to be able to pass data back and forth between app screens, which is where I'm running into trouble. The type of data I am concerned with is columns of numbers saved as a matrix.
My problem is that I cannot seem to get things set up correctly to pass a matrix between two apps. I have been able to pass text from input fields between apps (such as is seen here https://www.youtube.com/watch?v=u0jgIWAxf0Y), but passing a matrix of data continues to elude me. My main approach has been to follow these steps here, but to no avail: https://www.mathworks.com/help/matlab/creating_guis/creating-multiwindow-apps-in-app-designer.html.
I have attached two sample apps, "main" and "dialog". For the purposes of this post, these two apps are a version of what I'm trying to do in a simplified form. Essentially, the main app will calculate x and display x in a table. "Pass Data to Dialog and Open Dialog" should (theoretically) do as its name suggests. Once the dialog app opens, the "View Data from Main" should populate a table in the dialog app with the matrix "x" calculated in the main app.
Any suggestions would be greatly appreciated! Once I am able to pass matrices between apps I can begin to scale this up for use with my data cleanup script.
Many Thanks!

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Nov. de 2023
  3 comentarios
Image Analyst
Image Analyst el 22 de Nov. de 2023
If one app calls the other app, then you can pass stuff back in the output argument list.
If they're two completely independent apps, it might be best to use some agreed upon filename, like "data transfer.mat", and put all the variables you want to transfer into that, and then just have one app write it out and the other app read it in. Or you could try to do it just in memory using the base workspace and evalin and assignin. Or maybe you could use the global workspace without those functions - you just have to declare the variable names as global in each function that needs to change them or use them.
Kylen
Kylen el 22 de Nov. de 2023
Thank you for the answer. I ended up getting assignin and evalin to work.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by