execute system commands in matlab
Show older comments
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 Comments
Walter Roberson
on 6 May 2021
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
on 6 May 2021
Walter Roberson
on 6 May 2021
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
on 6 May 2021
Walter Roberson
on 6 May 2021
[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
on 6 May 2021
Edited: Thomas Schäfer
on 6 May 2021
Walter Roberson
on 6 May 2021
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
on 6 May 2021
Walter Roberson
on 6 May 2021
Looks good.
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!