How to define a user path in C++
이전 댓글 표시
Dear support
I call matlab scripts in a C++ application using the generic interface and that works quite well.
But, if my main script (main.m) locate in the folder A calls a function (foo) defined in foo.m, and located in folder B, then I got an error such as
Undefined function or variable 'foo'.
I tried to define the environemnt variable MATLABPATH and also to modify pathdef.m, without success .
Is there a way to tell Matalb where to look for user's function ?
Thanks for your help
Best Regards
Domenico
댓글 수: 3
Jan
2019년 5월 22일
From where did you modify which pathdef.m file? There can be one in the user's working directory and one inside Matlab's installation folder.
The run command let you specify a folder also on demand.
Jan
2019년 5월 22일
Hi Jan
I modify pathdef.m from the Matlab application , using the setPath icon.
There is a copy of pathdef.m in my user's directory (/home/$USER, I am on Ubuntu 18.04) and also in my working directory.
When I start matlab and run the script from matlab, everything is going fine.
When I use the C++ generic interfaces (generated from mcc) and call the m file from a C++ application (using feval(...)), I got a crash (undefined function or variable 'XXXX')
Jan
2019년 5월 22일
Please post comments in the section for comments.
Which pathdef.m file is used in your case? Is the "B" folder included there or not? Is the "B" folder included, when you create a stand-alone application?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deploy to C++ Applications Using MATLAB Data API (C++11)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!