Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

simulink matlab function block build error

Asked by Istvan on 9 Jun 2011
      Hi,
I am trying to build the most simple simulink model: constant source --> matlab function block (doing out = in) --> sink (out). 
When using matlab function block, at the step of buolding the model, I get an error... any ideas why? I am grateful for any suggestion. 

Here is the error:

myModelName =

test

 +++++ opening model test & setting parameters...
 +++++ building model test ...

### Starting xPC Target build procedure for model: test ??? Error using ==> tlc_c at 174 Error using ==> create_file_name_info at 267 unexpected compiler

Error in ==> RTW.makertw.make_rtw at 267 buildResult = tlc_c(h,...

Error in ==> make_rtw at 22 buildResult = h.make_rtw(varargin{:});

Error in ==> C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\private\build_target.p>RunBuildCmd at 94

Error in ==> C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\private\build_target.p>build_target at 6

Error in ==> C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\private\build_standalone_rtw_target.p>build_standalone_rtw_target at 51

Error in ==> C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\private\slbuild_private.p>loc_codegenentry at 527

Error in ==> C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\private\slbuild_private.p>slbuild_private at 303

Error in ==> sl at 16 [varargout{1:nargout}]=feval(varargin{:});

Error in ==> slbuild at 62 sl('slbuild_private', mdl, varargin{:});

Error in ==> rtwbuild at 163 slbuild(sys, 'StandaloneRTWTarget', ...

Error in ==> quicksetup_function at 191 rtwbuild(myModelName); % Build and download application.

Thank you!

Istvan

0 Comments

Istvan

2 Answers

Answer by Arnaud Miege on 9 Jun 2011
Accepted answer

Have you set up your C compiler and target settings in xPC Target Explorer? Have tried running xpctest? You should go through the Getting Started section of the documentation before doing anything else.

Arnaud

5 Comments

Istvan on 9 Jun 2011

Note To configure your C compiler for the xPC Target software, use the xPC Target Explorer interface (see “Configuring the xPC Target Host PC for Your C Compiler” on page 2-19). Be aware that the mex -setup command does not set the C compiler for the xPC Target product.

Istvan on 9 Jun 2011

So mex -setup solved the issue. (sets up C comp. for Host PC, separately from the Target PC).
Thank you very much!
Istvan

Arnaud Miege on 9 Jun 2011

Excellent. Yes, you need a compiler when using the MATLAB Function, which needs to be set up separately from the one used for xPC Target (although it could be the same compiler).

Arnaud Miege
Answer by Carlos on 27 Feb 2012

Thanks friends. It was extremely helpful for me too.

0 Comments

Carlos

Contact us