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

조회 수: 3 (최근 30일)
Javid Moraveji
Javid Moraveji 2024년 5월 28일
댓글: Javid Moraveji 2024년 5월 29일
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
Image Analyst
Image Analyst 2024년 5월 28일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by