S-Function cannot find a file (.exe) but it is clearly in the Matlab path

3 visualizaciones (últimos 30 días)
Hello,
I am working with a third party software (CarSim 2021) that is using a controller provided by a supplier as a black box. I have added Directory1 and its sub-folders to the Matlab path. The error message is (some names modified):
Error reported by S-function 'Sfun_GenericSM_blahblah' in 'Directory1/Directory2/Directory3/Controller/ESP Controller Interface/ESP8':
===> !!! Error GetLastError(2): File anExecutable.exe does not exist !!!
I can navigate to the .exe file and run it in my working directory within Directory1. I copied "anExecutable.exe" in additional locations within the Directory1 and Directory2 to address any potential path issue. I do see Sfun_GenericSM_blahblah.mexw64 in the path (as mentioned in https://www.mathworks.com/matlabcentral/answers/735042-s-function-does-not-exist-but-is-clearly-in-the-matlab-path).
I know this model ran on a different machine in the past; but, not sure about the Matlab version. I used both Matlab 2017b and 2023b. I get the same error.
I do not have access to the source code and the block SFunction parameters does not explicitly refer to the .exe file when I open the block parameters dialouge box.
Is there a way to point the model to the file (.exe) that it cannot find?
Thanks for the help!
  4 comentarios
Image Analyst
Image Analyst el 28 de Mayo de 2024
Just because Directory1 is in the path does not mean its subfolders are also in the path. Try adding absolutely everything in that packages folder to the path. Like if topLevelFolder is the top level folder and there's a bunch of subfolders and sub-subfolders within that, do this (like maybe put this in the startup.m file)
addpath(genpath(topLevelFolder);
savepath;
You can also use the setpath button on the tool ribbon and click the "Add with subfolders" button.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by