필터 지우기
필터 지우기

How to compile .mex from folders path?

조회 수: 13 (최근 30일)
Gundeep
Gundeep 2023년 2월 6일
댓글: Jan 2023년 2월 9일
I need to compile .mex files from path folder. Is there any command for that or any other process for compiling mex files. Below are the files
Suppose I need to use this function mex_pb_parts_final_selected in demo.m file and it gives me an error mex_pb_parts_final_selected function is not exist. Can someone guide me how I resolve this error? Thanks
  댓글 수: 2
Jan
Jan 2023년 2월 6일
These files are compiled already for MacOS computers. If they cannot be accessed from am M-file, either the folder i not included in the path, or you do not run Matlab on a Mac.
Gundeep
Gundeep 2023년 2월 7일
Hey Jan, I am using windows OS and main.m file I already includes these paths as below
addpath(genpath(('third_party/Tardif')));
addpath('third_party/BSR/grouping/lib');
addpath('mexFunctions');

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

채택된 답변

Jan
Jan 2023년 2월 7일
이동: Jan 2023년 2월 7일
@Gundeep: Prefer using absolute paths. If e.g. the folder "mexFunctions" is in the current folder, use:
addpath(fullfile(cd, 'mexFunctions'))
Maybe addpath() tries to o this automatically, but the explicit definition of the wanted folder is safer.
As I've written already, the mex files are compiled for MacOS and cannot be used under Windows. You need the source codes in C or C++ and compile them for Windows. If you do not find the sources or instructions for a compilation, you have to contact the authors.
  댓글 수: 22
Rik
Rik 2023년 2월 9일
I am not the administrator for that website nor for your computer, so I can't fix that for you. When I right-clicked that link and chose the 'save link as' option I was able to save the tgz file. If you are unable to do so, you will need to contact the administrator for that website, or your computer, or both.
Jan
Jan 2023년 2월 9일
@Gundeep: When I click on this link, the download starts directly. Unpacking fails due to missing rights to create symbolic links, but I assume unpacking with admin privileges will work. The file is too big to be posted here as attachment.
How to download a file from the web is not a Matlab problem.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2023년 2월 7일
편집: Image Analyst 2023년 2월 7일
I don't understand. Like Jan said it looks like they have already been compiled into mex files. Do you want to compile your demo.m file that uses those .mex files? If so you might need to use the -a option in mcc or else just put the full path to them when you call loadlibrary in your .m file code.
If it says that it can't find mex_pb_parts_final_selected(), then that function is not in your demo.m file like you thought and it's not anywhere on the search path. Try putting it in the same folder as demo.m.
  댓글 수: 2
Gundeep
Gundeep 2023년 2월 7일
Hello, in the below path this function exist mex_pb_parts_final_selected() is located and demo.m file is located on another path. Can you guide me for this?
third_party/BSR/grouping/lib
Image Analyst
Image Analyst 2023년 2월 7일
Which DLL is mex_pb_parts_final_selected() trying to call?
Which DLL is for the Windows platform? You can't call a mex file made for a Mac.
Use the SetPath button on the Home tab of the tool ribbon and make sure you save the path, or make sure you call setpath() after you call setpath().

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

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by