What is the issue I have when trying to create this MEX function.

1 view (last 30 days)
I want to create a MEX function for this function:
function [CrispOut,UNR] = T2FCMfis_ForMex(InI,m,R,SM)
%#codegen
[rules,dim,gen]=size(R); in=dim-1;
UNR=zeros(rules,dim); UNrule=zeros(gen,dim,rules);
for i=1:rules
UNrule(:,:,i)=(reshape(R(i,:,:),[dim,gen])');
UNR(i,:)=( SM(i,:)*UNrule(:,:,i) )./sum(SM(i,:));
end
mu=FCMmembership(InI,m,UNR(:,1:in));
nmu=(mu-min(mu))./(max(mu)-min(mu));
CrispOut=(nmu*UNR(:,dim))/sum(nmu);
end
My objective is to evaluate if it would perform faster. The thing is that for some cases this function will work with very large R and SM inputs.
With the purpose of creating the MEX function I followed the instructions on the MatLab help and firstly loaded to the workspace the following:
InI=[0.12,0.7,0.23];
R(:,:,1)=[0.9,1,0,0.1;0.2,0.9,0.05,0.2;0.1,0.8,0.1,0.3;0,0.7,0.1,0.7;0,0.5,0.2,0.9;];
R(:,:,2)=[0.91,0.9,0.05,0.15;0.21,0.91,0.1,0.22;0.2,0.9,0.15,0.32;0.01,0.65,0.15,0.75;0,0.6,0.2,1;];
R(:,:,3)=[2,2,2,2;0.2,0.91,0.1,0.21;0.1,0.8,0.1,0.35;2,2,2,2;0.1,0.55,0.23,1.1;];
SM=[0.3,1,0;0.1,1,0.4;0.2,1,0.05;0.9,1,0;0.6,1,0.1;];
m=2;
Afterwards I tried to create the MEX file with this command:
-args {InI, m, R, SM} T2FCMfis.m
I got the following error:
Error in ==> T2FCMfis_ForMex Line: 1 Column: 1
Code generation failed: Open error report.
Error using codegen
So I went to the error report and found out this:
1 xcrun -sdk macosx10.7 clang -c -fno-common -arch x86_64 -isysroot -mmacosx-version-min=10.7 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG -I "/Applications/MATLAB_R2013a.app/simulink/include" -I "/Applications/MATLAB_R2013a.app/toolbox/shared/simtargets" -I "/Applications/MATLAB_R2013a.app/rtw/ext_mode/common" -I "/Applications/MATLAB_R2013a.app/rtw/c/src/ext_mode/common" -I "/Users/luisalbertotorressalomao/Dropbox/MATLAB/GT2_GD_RL_AC_Modelling/MEX_Programs" -I "/Users/luisalbertotorressalomao/Dropbox/MATLAB/GT2_GD_RL_AC_Modelling/MEX_Programs/codegen/mex/T2FCMfis_ForMex" -I "/Applications/MATLAB_R2013a.app/extern/include" "T2FCMfis_ForMex_data.c"
2 xcrun: error: SDK "macosx10.7" cannot be located
3 clang: warning: no such sysroot directory: '-mmacosx-version-min=10.7'
4 In file included from T2FCMfis_ForMex_data.c:12:
5 /Users/luisalbertotorressalomao/Dropbox/MATLAB/GT2_GD_RL_AC_Modelling/MEX_Programs/codegen/mex/T2FCMfis_ForMex/T2FCMfis_ForMex.h:13:10: fatal error:
6 'math.h' file not found
7 #include
8 ^
9 1 error generated.
10 gmake: *** [T2FCMfis_ForMex_data.o] Error 1
I think this has to do with my computer and 'SDK "macosx10.7"'. What can I do? Any help will be greatly appreciated since this is the time I try this.

Answers (0)

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!