- Create the project.
- Create a command line project, for example “EngineDemo”. From the menu of Xcode, select File -> New -> Project. After the new window pops up, choose “Command Line Tool” from Application under OS X category. In following steps, choose C++ as the Language and fill “EngineDemo” as Product Name.
- Delete the automatic generated C++ file. Right click on the generated file “main.cpp” under folder “EngineDemo” in the Project navigator view and select “Delete”.
- Add the Engine example file to the project. Right click on the folder “EngineDemo” under “EngineDemo” project in Project navigator view, choose “Add Files to EngineDemo” and then select the file “engdemo.cpp” from “<matlabroot>/extern/examples/eng_mat/” folder. “<matlabroot>” represents where the folder MATLAB is installed, for example, “/Applications/MATLAB_R2015a.app”.
- Configure the Build settings.
- Click on the project “EngineDemo” from the Project navigator view.
- Add linker flags. Choose Build Settings -> Linking -> Other Linker Flags. Add “-leng –lmx” to the debug build.
- Add header paths. Choose Build Settings -> Search Paths -> Header Search Paths, add “<matlabroot>/extern/include” to the debug build.
- Add library search paths. Choose Build Settings -> Search Paths -> Library Search Paths, add “<matlabroot>/bin/maci64” to the debug build.
- Configure environment variables for debugging.
- From the menu of Xcode, select Product -> Scheme -> Edit Scheme.
- After the new window pops up, select Run/Debug from the left panel and choose “Debug” from Build Configuration in the Info panel.
- Select Arguments from the right panel and add following environment variables in the Environment Variables section: DYLD_LIBRARY_PATH with value “<matlabroot>/bin/maci64”, and PATH with value “<matlabroot>/bin:$PATH”.
- Build and run the Engine application “EngineDemo”.
How can I build an Engine application using Xcode 6 or later?
조회 수: 3 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2018년 2월 15일
편집: MathWorks Support Team
2021년 9월 9일
I would like to run the MATLAB Engine demo 'enginedemo.cpp' in Xcode 6. How can I do that?
The instructions provided here in MATLAB Answers are outdated:
채택된 답변
MathWorks Support Team
2021년 8월 17일
편집: MathWorks Support Team
2021년 9월 9일
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from C에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!