I had a similar problem. Here's how I approached it. I have a periodic signal where the fundamental frequency is known a priori. I want to output the peak-to-peak amplitude for the most recent period of the fundamental frequency as it evolves throughout my simulation. I used a Tapped Delay block in Simulink to sample the signal and output the most recent n samples. I chose the sample period for the block such that the block output will always contain slightly more than 1 full period at the fundamental frequency. Consequently, the Tapped Delay block contains n samples for 1 period of the fundamental frequency. Then, I used max and min blocks to get the highest and lowest values from the Tapped Delay. The difference between these two values is the peak-to-peak amplitude of the most recent fundamental period but I also have access to the most recent peak values. Sampling the peak-to-peak amplitude signal at the fundamental frequency provides a nice clean history of peak-to-peak values for plotting.