execute system commands in matlab
显示 更早的评论
Hi
I can not figure out how to write the correct input for matlab system (or dos, I have tried both) commands.
That I want to do is to call the program HFSS with certain flags. I have verified that it works correctly in a CMD prompt. Here I use the line:
"C:\Program Files\HFSS11\HFSS11\hfss.exe" -runscriptandexit "D:\HFSS Projects\read_variable_from_file.vbs”
I can not make it work in matlab, I would appreciate if someone could help me.
My thanks in advance!
BR
Thomas
9 个评论
Walter Roberson
2021-5-6
What happens if you use
cmd = '"C:\Program Files\HFSS11\HFSS11\hfss.exe" -runscriptandexit "D:\HFSS Projects\read_variable_from_file.vbs"';
[status, msg] = system(cmd)
Thomas Schäfer
2021-5-6
Walter Roberson
2021-5-6
I am having difficulty finding a copy of the documentation for HFSS11 that is not on a crack site, as the software is from February 2009.
Try
2>&1
cmd = '"C:\Program Files\HFSS11\HFSS11\hfss.exe" -runscriptandexit "D:\HFSS Projects\read_variable_from_file.vbs" 2>&1';
[status, msg] = system(cmd)
and show the msg that results.
Thomas Schäfer
2021-5-6
Walter Roberson
2021-5-6
[status, msg] = system('"C:\Program Files\HFSS11\HFSS11\hfss.exe" -HELP')
and see if you get anything back. That is, we need to start by verifying that we are able to communicate with the program.
Also,
exename = "C:\Program Files\HFSS11\HFSS11\hfss.exe";
if exist(exename, 'file')
fprintf('okay, executable exists, "%s"\n', exename);
else
fprintf('executable does not seem to exist, "%s"\n', exename);
end
Thomas Schäfer
2021-5-6
编辑:Thomas Schäfer
2021-5-6
Walter Roberson
2021-5-6
I would tend to suspect DLL seach problems; https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order . For example that document hints that if there is a DLL loaded by MATLAB, then possibly hfss would attempt to use the already loaded DLL instead of doing any kind of searching for it. That could be a problem if the two DLLs have the same name but are different DLLs or different versions of the same basic DLL.
Thomas Schäfer
2021-5-6
Walter Roberson
2021-5-6
Looks good.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!