Using system() or ! with deployed executable

4 次查看(过去 30 天)
J D
J D 2018-5-11
评论: Greg 2018-5-14
I've written a script that allows the user to select multiple folders then sequentially:
1) feed those folders into an external executable (which only accepts one folder at a time) that takes a significant amount of time to run,
2) perform work on the files generated by the external executable once it's done
The script works great on my PC, as does the executable generated by mcc.
My problem is that when I attempt to run this program on other PCs that only have MCR, not full MATLAB, the system calls are not functioning at all. I have ensured that the paths are correct, and verified that the MCR PC can indeed run the command. To verify this, I called the deployed executable from a command line so the output would persist. I included a line that simply writes the argument I'm using for the system() call before making the system call, then running that string directly after the deployed executable finishes.
Unfortunately this is work related and I'm prohibited from posting the actual code, but in my debug process I've tried the following:
c = 'Super\secret\command_line_program arguments';
c
system(c)
dos(c)
eval(['!' c])
I get
ans =
'Super\secret\command_line_program arguments'
ans =
-1
ans =
-1
ans =
-1
I can further verify the super secret command line program is not executing because the files it would generate are not being generated. When I copy the content of variable c and paste it directly to the MCR PC's command line, it executes the program as expected.
Can someone help me figure out what I'm doing wrong?
Bonus question: Any idea why my mcc calls are taking 12+ minutes to run for literally as little as 2 lines of code?
mcc -mv debugTestScript.m
Matlab 2017a, Compiler 6.4
Thanks in advance!
  5 个评论
J D
J D 2018-5-14
@Walter: I tried that (although I had to replace fileattr() with fileattrib()). MATLAB's fileattrib() output is displayed as expected, but as before status is left with -1 and message is empty. Again, when I call attrib with the full path and filename exactly as it is in the script from the target PC's command line by hand, it shows the correct information.
@Greg: The command line program is confirmed at that location. One thing I didn't make clear in the OP is that I am specifying the full path to the executable to prevent any issues with relative directories since I've had that issue in the past.
Greg
Greg 2018-5-14
So what are the messages returned by the system calls when it is compiled?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by