prlctl: take input from script instead of command window
1 次查看(过去 30 天)
显示 更早的评论
I would like to automate the following sequence: enter a parallels VM, run executable, exit VM, check results using MATLAB, adjust settings, then re-enter and re-run executable until I get a certain result.
I am running a system command to enter the VM's terminal. Once I do this I would like to continue with the next line of code to be entered into the VM terminal.
For example, I would like to enter, run a command, then exit. Trying this:
!prlctl enter VM
dir
exit
MATLAB is busy after the first line, waiting for input from MATLAB's command window. I can type dir then exit on the command window and it works as expected, but how do I automate it so the the next line of input to the VM is coded instead of taken from MATLAB's command window?
0 个评论
采纳的回答
Walter Roberson
2018-5-21
编辑:Walter Roberson
2018-5-21
Write the text into a file, and use I/O redirection.
tname = tempname();
fid = fopen(tname, 'wt');
fprintf(fid, 'dir\nexit\n');
fclose(fid);
cmd = sprintf('prlctl enter VM < "%s"', tname);
[status, message] = system(cmd);
2 个评论
Walter Roberson
2018-5-21
Oh yes, and remember to delete the file afterwards. You might want to use onCleanup() for that.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!