필터 지우기
필터 지우기

loadlibrary mfilename put in sub folder

조회 수: 2 (최근 30일)
Thomas Carpenter
Thomas Carpenter 2015년 7월 20일
댓글: Thomas Carpenter 2015년 7월 21일
I have a rather large Matlab project (over 100 function files etc.) which I have organised into folders to make it easier to keep track of. The project at its heart has a C DLL which it loads to access some physical hardware. When this is loaded it creates an m file (named through the 'mfilename' option when calling 'loadlibrary'). I would like if possible this m file to be placed in one of the subdirectories not the top level (current) directory.
I tried simply changing the mfilename option to include a relative path but this was completely ignored and the mfile placed in the top directory regardless.
Is there anyway of getting this to happen automatically?
Furthermore, is it possible to get the 'thunk' files to also be placed in a subdirectory to keep things clean?
---
Along similar lines but less importantly, when compiling mex functions, is it possible to specify the output directory for them?

채택된 답변

Philip Borghesani
Philip Borghesani 2015년 7월 21일
The thunk file can be placed anywhere by adding the thunkfilename option with a path to the desired location. The only way to control the placement of the prototype file is to issue a cd command to the desired location first. This guarantees that the location is on the matlab path which is required to run the prototype file. Full path names are supported for the header and dll file names so it should be possible to generate these files in any location. An alternate solution is to copy/move the files after generating them.
  댓글 수: 1
Thomas Carpenter
Thomas Carpenter 2015년 7월 21일
Excellent, changing directory did what I want. Not entirely sure why I didn't think of that! Didn't even need to name the thunk file, it appeared in the directory with the m file.

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 7월 20일
To your second question, Yes:
web(fullfile(docroot, 'matlab/ref/mex.html'))
Look at the 'outdir' option.

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by