You are here: Symbol Reference > Dew Namespace > Dew.Signal Namespace > Dew.Signal.Units Namespace > Classes > SignalUtils Class > SignalUtils Methods > SignalUtils.ReadFromCircularBuffer Method
Dew Signal for .NET
ContentsIndexHome
Example

Circular buffer test.

using Dew.Math; using Dew.Math.Editors; using Dew.Math.Units; using Dew.Signal; using Dew.Signal.Units; using Dew.Math.Tee; using Dew.Signal.Tee; private void button1_Click(object sender, EventArgs e) { Vector b = new Vector(0); Vector c = new Vector(0); Vector h = new Vector(0); int n = 6; int i; TCircularBufferState State = new TCircularBufferState(); Vector h1 = MtxExpr.Ramp(30, TMtxFloatPrecision.mvDouble, 0,1); c.Size(h1); c.SetZero(); h.Size(h1); h.SetZero(); SignalUtils.InitCircularBuffer(11,2,ref State); int h1Length = h1.Length/n; for (i = 0; i < h1Length; i++) { h1.SetSubRange(i * n, n); h.SetSubRange(i * n, n); c.SetSubRange(i * n, n); SignalUtils.WriteToCircularBuffer(b, h1, ref State,false); n = SignalUtils.PeekCircularBuffer(State); SignalUtils.MonitorCircularBuffer(b, h, ref State); SignalUtils.ReadFromCircularBuffer(b, c, ref State, -1); } h1.SetFullRange(); h.SetFullRange(); c.SetFullRange(); MtxVecTee.DrawIt(new TVec[3] {h1,h,c}, new string[3] {"Original","Monitored","Read"},"Circular buffering",false); }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.