C# 中二维数组的方程
我有一个 310 行和 120 列的数组。
我每隔 10 秒就会从串行端口获取填充该数组的数据。
如何将此数据发送到数组的第一行,并在下一次迭代时连续发送到该行,直到操作完成?
完成后,取数组的最大值、最小值和平均值。最后是数组中所选单元格的平均值、最大值和最小值。
C# 中的数组可以实现吗?
([7,31]-xxxxx.MIN([$28$5:$45$95])/(xxxxx.MAX[$28$5:$46$95]-xxxxx.MIN[$28$5:$45$95])
I have an array with 310 lines and 120 columns.
I get the data that will populate this array from serial port at intervals of 10 seconds.
How to send this data to the first row of the array and on the next iteration to the line down and it continuously until the operation is complete?
Once completed, take the maximum, minimum and average of the array. And finally, the average, maximum and minimum of a selection of cells in the Array.
This is possible with array in C#?
([7,31]-xxxxx.MIN([$28$5:$45$95])/(xxxxx.MAX[$28$5:$46$95]-xxxxx.MIN[$28$5:$45$95])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在问题下面发表的评论澄清了一点,但评论的扭曲性质使这一行变得混乱:
所以我现在假设那些奇怪的字符是终点线。否则进行调整。
将 arraylength 设置为 120 是完全没有必要的,并且二维数组不会添加此处可用的新方法。我们将使用锯齿状数组来代替。 310的长度可能有某种原因,所以我们保留它。
因此,在每一行中,前 24 个“单元格”是来自流的输入。我不熟悉端口,但我可以放心地假设您可以将 RS485/USB 路由到 Stream 对象。
单元格 0、4、8、12、16 和 20 填充有 ID({01、02、03、04、05、06} 之一),以指示它来自哪个 LPC。
但稍后在评论中您指定想要这个:
即使在 Excel 中,这也会采用这些 ID 的最小值/最大值/平均值。不过,我们在这段代码中避免了这种情况,它忽略了这些列。
这应该是不言自明的。创建一个 LaserArray,初始化流,读取数据,然后享受结果。
另外,我很无聊并且正在度假,所以这就是为什么我要如此详细地回答一个一年前的问题。
亦名誉也。
The comments you made below your question clarified it a bit, but the screwy nature of comments jumbled this line:
So I'll just assume for now that those weird characters are an endline. Adapt it otherwise.
A set arraylength of 120 is completely unnecessary, and a 2-dimensional array adds no new methods usable here. We'll just use a jagged array instead. The length of 310 probably has some reason, so we'll keep that.
So on each row, the first 24 "cells" are the input from the stream. I'm unfamiliar with ports, but I can safely assume you can route that RS485/USB to a Stream object.
Cells 0, 4, 8, 12, 16 and 20 are filled with IDs, one of {01, 02, 03, 04, 05, 06} to indicate what LPC it came from.
But a bit later in the comments you specify wanting this:
Even in Excel, this would take the mini/max/average over those IDs as well. We're avoiding that in this code though, it ignores those columns.
This should be self-explanatory. Create a LaserArray, init the stream, readIn the data, and then have fun with the results.
Also, I'm bored and on vacation, so that's why I'm answering a year-old question in such great detail.
Also reputation.