Figure 6-4. example of a split vector – National Instruments AutoCode NI MATRIX User Manual

Page 181

Advertising
background image

Chapter 6

Vectorized Code Generation

AutoCode Reference

6-18

ni.com

Figure 6-4. Example of a Split Vector

Example 6-7

Generated Code for Split Vector (for Figure 6-4)

/***** Output Update. *****/

/* ---------------------------- Gain Block */

/* {gain.top.2} */

for (i=1; i<=5; i++) {

top[-1+i] = R_P[-1+i]*U->gain_1[-1+i];

}

/* ---------------------------- Gain Block */

/* {gain.bottom.1} */

for (i=1; i<=5; i++) {

bottom[-1+i] = R_P[4+i]*U->gain_1[4+i];

}

/* ---------------------------- Gain Block */

/* {gain..99} */

for (i=1; i<=2; i++) {

Y->result[-1+i] = R_P[9+i]*top[-4+4*i];

}

Y->result[2] = 3.4*bottom[2];

Y->result[3] = 4.5*top[1];

Y->result[4] = 5.6*bottom[0];

Y->result[5] = 6.7*top[1];}

Advertising