Labview - Increasing Array Index with Array Size Limiting

孤街醉人 提交于 2019-12-12 18:33:41

问题


I'm working with a labview XY line plot that uses a random number generator for y values and the while loop count for x values. Upon reaching a threshold x value, say 1000, I'd like to be able to iterate across the past 1000 values and display only every 10th (This has the effect of de-cluttering the plot). Ideally the method for achieving this would be expandable for higher threshold values so that the plot has the following format:

Every 1,000 values, step size is 10

Every 10,000 values, step size is 100

Every 100,000, step size is 1,000

etc.

Below is the code I've been working with, and a picture of the VI. My question is, is there a better way to achieve this effect without having to delete values from the arrays as I am currently doing (inside the for loop)?

Code

Virtual Instrument


回答1:


What you are referring to is called "decimation" (literally here i think, as you are breaking it down by 10s). There is a function in LabVIEW for decimating arrays, more info on that can be found here.

This seems like a simplified version of what you are trying to do using the decimate VI

There are configurable decimating VIs that can be used from the Signal Operations palette that can do the decimation with a decimation factor, see here or from 3rd party packages. MGI has one on one of their palettes called MGI Decimate Array with Offset. You can replace the decimate function in the code above with any of those and change the decimation factor based on the size of the array coming in.

EDIT: @JonathanVahala was asking about using configurable decimation below. See this image which shows a way to do this:

You can replace the case structure with this one to decimate this way.



来源:https://stackoverflow.com/questions/56383862/labview-increasing-array-index-with-array-size-limiting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!