Understanding relative paths when running compiled Matlab executable

I have an issue which I think is a result of my lack of understanding of how relative paths work in Matlab and I was wondering if someone could help me. Effectively, I have an Matlab executable (.exe) that I want to run from my own code.
Basically my folder structure is the following:
MyProject/
MyCode/
ThirdPartyMatlabModel /
MatlabModel.exe
Data /
The data ingested by the model
If I run MatlabModel.exe from windows explorer everything works fine and the model works.
However when I try to run the executable from the my code I end up with the following error messages.
Error using textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
Error in parseINI
MATLAB:FileIO:InvalidFid
Does Matlab take relative paths from where the EXE is run from?
Does anyone have any suggestions as to how to rectify this issue?
Thank you for any response.

5 件のコメント

Rik
Rik 2020 年 4 月 3 日
Wouldn't this be easy to check by inserting a dialog box that displays the pwd?
One thing you could try is using the mfilename function to find the location of your exe. I don't know if that would work, but it is worth a try.
TabularConferta
TabularConferta 2020 年 4 月 3 日
編集済み: TabularConferta 2020 年 4 月 3 日
Unfortunately I don't have access to non-obscured Matlab source code. I only have access to the EXE and the folder with the ingested data. I should be able to get in contact with the third party, it will just take a bit of a time and bottle necks my work. So I guess I'm also trying to understand the issue further, to see if there is something on my side I can fix or if I have to message them.
Walter Roberson
Walter Roberson 2020 年 4 月 3 日
"Does Matlab take relative paths from where the EXE is run from?"
Only if it was created as a console application and you are running it from inside a terminal window.
TabularConferta
TabularConferta 2020 年 4 月 3 日
Thank you. I'll need to get in contact with the source and see if I can get them to rebuild it.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler SDK についてさらに検索

タグ

質問済み:

2020 年 4 月 3 日

コメント済み:

2020 年 4 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by