I just want to realize some function ,store a series data into a array,just like this below: double x; double y[200]; int i=0; step_interrupt(void) { y[i]=x; i++; if(i==200) i=0; } So, I just realize it by Block of "Tapped Delay" in Discrete, like this <<http://xjtudownload.googlecode.com/files/1.jpg>>,but when I generated the code,it's so inefficiency,just like this: 32 void test_step(void) 33 { 34 int_T i; 35 36 /* S-Function (sfix_udelay): '<Root>/Tapped Delay' */ 37 memcpy(&y[0], &test_DWork.TappedDelay_X[0], 200U * sizeof(real_T)); 38 39 /* Update for S-Function (sfix_udelay): '<Root>/Tapped Delay' incorporates: 40 * Update for Inport: '<Root>/In1' 41 */ 42 for (i = 0; i < 199; i++) { 43 test_DWork.TappedDelay_X[i] = test_DWork.TappedDelay_X[i + 1]; 44 } 45 46 test_DWork.TappedDelay_X[199] = x; 47 48 /* End of Update for S-Function (sfix_udelay): '<Root>/Tapped Delay' */ 49 }
I think some Block like "Delay" in Discrete Library have the Circular buffer function,except "Tapped Delay" Block. how can I realize it ?
Best Answer