10-01-2011 02:01 AM - edited 10-01-2011 02:03 AM
It is always easiest of you do things in a certain order:
Wire the output of the build array to the right shift register to automatically define its type as 2D DBL array and the rest will fall in place. Then go to the left shift register and "right-click...create constant" to initialize it with the correct type too.
(By the way, my image above is a LabVIEW snippet. All you need is to drag it to the block diagram and it will turn into valid LabVIEW code.)
10-01-2011 02:25 AM
That worked great it is much faster now thank you all for helping
10-01-2011 04:27 AM
Hi All,
I tried to implement the code we were talking about with my sensors and I am getting some rather strange results. I have attached the code below if anyone could please have a look at it and see what I am doing wrong in creating the array.
Thanks for the help
Canalian
10-01-2011 04:28 AM
10-01-2011 01:00 PM - edited 10-01-2011 01:01 PM
Your snippet is useless to troubleshoot. You did not include the subvi inside the loop. What does it do?
Maybe you want to place another shift register in the outer loop and wire the 2D array across so you keep a history across all iteratoins of the outer loop. Currently, you reinitialize the inner loop after each iteration of the outer loop, dropping all data between iterations, leaving you only the last set of 10 rows.
It also does not help if you tell us that you are getting "strange results". Thus is not a useful technical term. Please describe in detail in what way the results are "strange", what results you actually get, and what results you expect.
10-27-2011 09:36 PM
Hi,
I have an appended array with time string and certain values.
I have initialized a 2D array named Output Array In.
If I run this I get the continuous value only in the first row of the 2D array.
My requirement is I need to get (2011/10/28 10:26:18.155) (00) (09) (22 00 00 00 00 00 00 00) in 1st row
(2011/10/28 10:26:19.155) (00) (09) (22 00 00 00 00 00 00 00) in 2nd row
(2011/10/28 10:26:20.155) (00) (09) (22 00 00 00 00 00 00 00) in 3rd row... and so on in the 2D array.
Working version is LV7.1
Thanks
KB29
10-31-2011 08:46 AM
Hi KB29,
Instead of using the index array function, just wire up your loop iteration to the index of your Insert Into Array function. See screenshot. Let me know if you have any further questions!
Regards,
Travis Ann
10-31-2011 11:20 AM - edited 10-31-2011 11:21 AM
@Travis Ann N wrote:
Instead of using the index array function, just wire up your loop iteration to the index of your Insert Into Array function. See screenshot. Let me know if you have any further questions!
No, that's overly complicated.
If you want to start with an empty array, we don't even need the control on the left outside, and if this controls contains existing data, your code would push old data at the end of the array and retain it forever out of order, because "insert into array" is hardwired to the array index.
A better choice is a plain "Build array" as in the following code. The control (array in) on the left is only needed if you want to append to earlier data, else replace it with an empty array diagram constant (or even leave the shift regsiter unwired).
Be aware that growing arrays indefinitely, will have you run out of memory at one point.
11-20-2014 05:21 AM
Hi.. .
I was used your VI design in my block diagram. For my application, element wants to be add only one time. Another time another element wants to be ON. but it doesn't working like that. Its adding the values because of while loop. Is there any other way to solve this. . . .?
I am vey thankful for u, if u r replying. . .
11-20-2014 12:15 PM