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에서 C Shared Library Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by