Has anybody tried to create a mex file running as a tcp server? I'm trying to get rid of the error below and build a MEX file out of it.
I'm getting an error from my code generation report using matlab-coder to generate a mex file:
  • Found unsupported global data initialization class for global variable 'interfaceObject'.MATLAB class 'tcpip' found at 'interfaceObject' is unsupported.*
The code is something like this:
function TempStream_Live_D %#codegen
global interfaceObject
IP_to_track = '192.168.194.185';
coder.extrinsic('tcpip');
interfaceObject = tcpip(IP_to_track,2101,'NetworkRole','server');
...
Here's the hyperlink of the example tcpip-server file I edited from: http://www.mathworks.com/matlabcentral/fileexchange/345

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 11월 19일

0 개 추천

I'm not sure if there is a workaround to this, since it looks like MATLAB Coder does not support the 'tcpip' class for code-generation. In any case, if you have to make coder.extrinsic calls every time you have to use the interface object, which essentially dispatches the call to MATLAB engine, is there any advantage of creating a MEX-file?

댓글 수: 2

Denz Choe
Denz Choe 2012년 11월 21일
You are right! Your question prompts me to do some thinking should I even use MATLAB coder to optimize my code when in fact, all I want to do is just generate a standalone executable.. Now, I've abandon the optimizing idea. Thanks for your input :)
lll
lll 2012년 12월 10일
have you solved this problem? I am also facing this problem. The TCPIP class can not be supported in sfunction. How to use the m-code of server and client, to realise the communication in the different simulinks through local network then?

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

추가 답변 (1개)

Antoine Steiblen
Antoine Steiblen 2016년 6월 28일

0 개 추천

I have just run into this problem, any solutions since this post?

댓글 수: 2

Denz Choe
Denz Choe 2016년 6월 29일
편집: Denz Choe 2016년 6월 29일
Gosh, this is so long ago.. I did find a solution I think.. But I did not pursue with Matlab Coder. Let me see if I can dig up the files
Denz Choe
Denz Choe 2016년 6월 29일
편집: Denz Choe 2016년 6월 29일
Ok, I managed to find my codes.. But first; let me re-iterate, I did not pursue to build a MEX file with Matlab Coder.
The TCP Server I generated was an EXE file, using the Matlab Compiler instead. So it may not be a solution that you are looking for. Kaustubha Govind asked me what was the benefit of creating a MEX-File, and I couldn't find an answer, since what I actually wanted was to create a standalone EXE program.
To understand the difference between Matlab Compiler and Matlab Coder for EXE file or MEX file generation (in respective order); see the response from Kaustubha Govind https://www.mathworks.com/matlabcentral/answers/23369#answer_30714

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

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

질문:

2012년 11월 19일

편집:

2016년 6월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by