使用MatlabR2012a编译为LINUX Matlab代码时出错

时间:2014-11-26 13:02:29

标签: matlab udp matlab-coder

我正在尝试将Matlab函数编译为C. 在这里你有功能的声明:

function [SpdLmt0, SpdLmt1, SpdLmt2, SpdLmt3, SpdLmt4, SpdLmt5, SpdLmt6,
    SpdLmt7, SpdLmt8, SpdLmt9, SLDst0, SLDst1, SLDst2, SLDst3, SLDst4,
    SLDst5, SLDst6, SLDst7, SLDst8, SLDst9, IntTyp1, IntTyp2,
    IntTyp3, IntTyp4, IntTyp5, IntTyp6, IntTyp7, IntTyp8, IntTyp9,
    IntTyp10, IntDst1, IntDst2, IntDst3, IntDst4, IntDst5, IntDst6,
    IntDst7, IntDst8, IntDst9, IntDst10, StpDst1, StpDst2, StpDst3,
    StpDst4, StpDst5, StpDst6, StpDst7, StpDst8, StpDst9, StpDst10,
    BumpDst1,BumpDst2,BumpDst3,BumpDst4,BumpDst5,BumpDst6,BumpDst7,
    BumpDst8,BumpDst9,BumpDst10,SlopeVal1,SlopeVal2,SlopeVal3,SlopeVal4,
    SlopeVal5,SlopeVal6,SlopeVal7,SlopeVal8,SlopeVal9,SlopeVal10,
    SlopeDst1,SlopeDst2,SlopeDst3,SlopeDst4,SlopeDst5,SlopeDst6,
    SlopeDst7,SlopeDst8,SlopeDst9,SlopeDst10,Radius1,Radius2,Radius3,
    Radius4,Radius5,Radius6,Radius7,Radius8,Radius9,Radius10,CurvDst1,
    CurvDst2,CurvDst3,CurvDst4,CurvDst5,CurvDst6,CurvDst7,CurvDst8,
    CurvDst9,CurvDst10,UDP_error] = parser(UDP, longitud)

所以我收到来自" UDP接收"的UDP数据。用于LINUX的Simulink块。收到的消息由在ASCII代码中编码的100个数据(函数的输出)组成。我的功能"解析器"获取UDP消息并对其进行解码以获得所需的输出。 问题是当我尝试使用Simulink Coder编译它时,我有这样的信息:

  

错误:发生错误 - 中止

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

如果没有关于该功能的更多信息,很难确切知道可能发生的事情,但一个建议是你稍微调整函数调用本身。有了这么多的返回值,MATLAB Coder在转换函数时遇到错误是完全可能的。拥有那么多的返回值是非常不寻常的,它可能会导致问题。

我建议将返回值放入单个数据结构(结构或数组,具体取决于适当的位置)。这将简化您的函数调用,并可能帮助编码器。

相关问题