How to export from a GUI (.exe) to MATLAB workspace?
古いコメントを表示
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
採用された回答
その他の回答 (2 件)
math98
2011 年 6 月 14 日
0 投票
3 件のコメント
Walter Roberson
2011 年 6 月 14 日
pcode the code if you do not want it to be accessible.
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.
Chirag Gupta
2011 年 6 月 14 日
Although, I agree with Walter that pcode is correct/better solution
math98
2011 年 6 月 14 日
0 投票
4 件のコメント
Chirag Gupta
2011 年 6 月 14 日
May be I am not clearly understanding your use case. Let me clarify:
[You want to create an EXE to protect your code, but run the EXE on machines that already have MATLAB installed. When you are running the EXE, you want to see the results in the running MATLAB (live).]
There are a couple things regarding this:
a) EXEs from MATLAB compiler are typically used to run on platforms that do not have MATLAB installed.
b) Essentially, you want to be able to have the one EXE communicate with MATLAB (somewhat like software in the loop). There is no automatic way for that. You have to provide a channel (code it up) to communicate between the two. One option is UDP, another might be through COM (actxserver).
c) Regarding software distribution, there are numerous ways to offer it. The most important aspect is how is it meant to be used. If this is intended to be used in MATLAB, then pcode (IMHO) is the way to go. You can still zip all the files in one zip (or self extracting exe), script it so that it will automatically install it on the MATLAB path and offer a single gateway function to use it in MATLAB.
Walter Roberson
2011 年 6 月 14 日
Create one large file out of all of your .m files, and pcode that combined .m file.
To deal with your GUIDE .fig file, go back in to GUIDE and open the .fig file, and use the GUIDE menu to "export" the .fig file as a .m file. The result will be source code that creates the figure without needing the .fig file.
math98
2011 年 6 月 14 日
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.
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!