C defines when generating code with RTW

Discussion in 'MATLAB' started by Andrea Gelmetti, Jan 28, 2005.

  1. Hi all,

    I am generating C code from a simulink model with RTW by using the
    ert.tlc as system target file (Matlab R13).
    Suppose that I have got a file GLOBAL.h of mine which contains the
    macro

    #define N=4

    Now, what I want to do is to generate a code (that will include
    GLOBAL.h) and that will contain for instance a statement like the
    following one

    #include GLOBAL.h
    ..
    ..
    short vect[N]
    etc

    I am stucked because when I use vectors of size N (where N is a ws
    variable) in simulink, RTW always puts in the code the VALUE of N and
    not the symbol "N". No matter which storage class I assign N to.
    Of course this is a problem only when you have several models where
    vectors must have length N. If you have only one model no problem.
    As you might guess I want to avoid regenerating all my models when I
    want to change the value of N.
    Anybody has an idea?
    Thank you in advance.

    Andrea
     
    Andrea Gelmetti, Jan 28, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.