Sawtooth to Straight line in Simulink
The general idea is that you keep track of the previous input value and compare it to the current input value; the difference is the change that needs to be applied to the output. You also have a persistent variable that holds the current output value.

In normal operation, you simply add the delta to the output variable. But if the delta is negative and its magnitude is greater than half the range, that means that the input has "wrapped" in the positive direction. Adjust the delta by adding the range to it, turning a large negative value into a small positive value. Similarly, if the delta is positive and greater than half the range, it tried to wrap in the negative direction. Subtract the range from the delta.

I'm not familiar with the specific syntax used in Simulink, but in C, it would be something like this:

const unsigned range = 1024;

int unwrap (unsigned x)
{
   static unsigned prev_x = 0;
   static int output = 0;

   int delta = x - prev_x;
   if (delta &lt; -range/2) delta += range;
   if (delta &gt; range/2) delta -= range;
   return output += delta;
}