How to export from a GUI (.exe) to MATLAB workspace?
2 次查看(过去 30 天)
显示 更早的评论
Hi, Can anyone guide me how to export a created array in a GUI(.exe) to the MATLAB '*base*' workspace? Note: by GUI(.exe), I mean I've created a GUI .exe file using '*deploytool*'. If I run my GUI .m file (or .fig file using 'guide') I can use '*assignin*' function to do this export. But the mention function does not work if I run my .exe GUI. Should I run MATLAB from .exe GUI?
Thank you so much
0 个评论
采纳的回答
Walter Roberson
2011-6-13
The .exe has its own base workspace that you can assign in to all you like, but it will vanish as soon as the executable ends -- just like happens if you were to do something in MATLAB and then exit MATLAB.
Running MATLAB from the .exe wouldn't help much, in the sense that the .exe would not be able to make assignments in to the workspace of the live MATLAB.
The .exe could save() variables in to a .mat file, and you could load() the .mat file.
7 个评论
Gerd
2011-6-14
Of course you can make an .exe out of your code and share the program with other users. When all user want to share data (results, input vectors) I would use the load and save functions.
It is the same as you share and .xls ord .doc file
更多回答(2 个)
math98
2011-6-14
3 个评论
Chirag Gupta
2011-6-14
I must have deleted my previous answer by mistake. A possible solution for your unique case might be to use actxserver (actxGetRunningServer) [on windows only]. I think this might work, but I haven't really tried this.
math98
2011-6-14
4 个评论
Walter Roberson
2011-6-14
MATLAB has communications channels available, but you have put on tight enough restrictions as to how you want them to work that it is not possible to access the channels in your design. Communication has to be specifically enabled in almost all software systems. For that to happen, *some* code has to run in the context of the program that starts up the second program. The setup might only take a couple of statements, but you have put on restrictions that do not allow _any_ execution in the starting program: you insist on a single executable that runs in a different context.
I have not looked at the details of how .fig files are implemented. I have some ideas as to why a stand-alone .fig would likely not work, but I would have to test those ideas.
Note: Chirag works for Mathworks, but I am an experienced software developer who uses MATLAB as a customer; I have never had access to the internal design of MATLAB and I have never had access to Mathworks policy or planning.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!