Labview-通过数组大小限制来增加数组索引 [英] Labview - Increasing Array Index with Array Size Limiting

查看:929
本文介绍了Labview-通过数组大小限制来增加数组索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LabVIEW XY折线图,该图使用y值的随机数生成器和x值的while循环计数.达到阈值x值(例如1000)后,我希望能够遍历过去的1000个值并仅每10个显示一次(这会使图形变得混乱).理想情况下,用于实现此目标的方法可以扩展为更高的阈值,以使绘图具有以下格式:

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:

每1,000个值,步长为10

Every 1,000 values, step size is 10

每10,000个值,步长为100

Every 10,000 values, step size is 100

每100,000,步长为1,000

Every 100,000, step size is 1,000

下面是我一直在使用的代码以及VI的图片.我的问题是,有没有一种更好的方法可以达到这种效果,而不必像我目前所做的那样(在for循环内)从数组中删除值?

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)?

代码

虚拟仪器

推荐答案

您所指的是抽取"(我认为这是字面上的意思,因为您将其分解10 s). LabVIEW中有一个用于抽取数组的函数,有关更多信息,请参见此处.

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.

这似乎是您使用简化VI尝试做的简化版本

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

可以从Signal Operations面板中使用可配置的抽取VI,这些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.

@JonathanVahala在下面询问有关使用可配置抽取的问题.看到这张图片,该图片显示了执行此操作的方法:

@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.

这篇关于Labview-通过数组大小限制来增加数组索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆