execute system commands in matlab
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 6 Mai 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
le 6 Mai 2021
Walter Roberson
le 6 Mai 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
le 6 Mai 2021
Walter Roberson
le 6 Mai 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
le 6 Mai 2021
Modifié(e) : Thomas Schäfer
le 6 Mai 2021
Walter Roberson
le 6 Mai 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
le 6 Mai 2021
Walter Roberson
le 6 Mai 2021
Looks good.
Réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!