EngWinDemo Starts a New Instance?!

2 views (last 30 days)
Diego
Diego on 28 Feb 2014
Commented: Diego on 28 Feb 2014
Hello,
Ive compiled the engwindemo.cpp example in matlab using:
mex -f "C:\Program Files\Matlab\2013b\bin\win64\mexopts\msvc110engmatopts.bat" engwindemo.c
and I appended -automation and -regserver to my matlab shortcut which I start as administrator. When I click the icon to start matlab, the command window opens. I then run my engwindemo.exe and ANOTHER command window opens, a figure, a dialog, and then they close, leaving me with my origianl command window. Isnt this demo supposed to illustrate the exact opposite behavior? Its supposed to attach to the already open matlab instance! Instead it opens a new one!
I am running Matlab 2013b and Windows 8. My compiler is Visual studio 2012. The compilation in matlab happened without error.

Answers (1)

Jacob Halbrooks
Jacob Halbrooks on 28 Feb 2014
I suspect the issue is in trying to have the non-admin privileged engwindemo.exe connect to the admin privileged MATLAB process. Windows may not allow this, and so you get another MATLAB instance. You only need admin privileges to initially register MATLAB as an automation server. After that you should be able to run MATLAB as a normal user with just the -automation flag, and then when you run engwindemo.exe it will connect to that instance.
Alternatively, you can run engwindemo with admin privileges against your current way of running MATLAB, but you should probably run both as normal user instead.
  1 Comment
Diego
Diego on 28 Feb 2014
Running matlab with the -automation -regserver -nodesktop -nosplash as an administrator, and then running engwindemo.exe as an administrator did idneed use the same matlab instance so thank you!
But I am still a little confused. When I come in in the morning and start my comptuer, I start matlab above. My end goal is to write a script for an external editor allowing me to edit code outside of matlab, and when I press a specific key, it sends the goal/script name to matlab and runs it. I ahve accomplished that, except a new command window opens ever time so I am pursuing this angle to see if I can get it working to only one instance open at a time.
So my idea is to pass the script name to the .exe I will create based off of engwindemo that will do that for me.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!