LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array insertion issue

I am having trouble with the attached VI. It is supposed to take a screenshot, and add that to a picture array. It does that for the first index of the array, but on the second pass, it replaces the previous screenshot. It should add the new image to the next index within the array instead. Any thoughts?
 
---God's Templar---
 
 
0 Kudos
Message 1 of 10
(3,087 Views)
Every time your code runs, you are creating an array with one element, so what you are seeing is as expected. You need to  keep your array in a shift register, then append a new element to the existing array using e.g. "built array".
Message 2 of 10
(3,084 Views)

What I mean is, when the code runs, it copy/pastes the image into index 0, then stops running. On the second run, it inserts a new screenshot at index 1. (repeat as many times as user decides). It does not automatically execute a second time. When that gets working, I intend to add the ability to clear the array, and a few other minor doohickies.

---God's Templar---

Message Edited by God's Templar on 08-06-2007 12:30 PM

0 Kudos
Message 3 of 10
(3,075 Views)

Christian is absolutely right: Use a shift register. 

How to use and what you can do with shift registers you can take e.g. from the LabVIEW examples, especially "Find Maximum Value from Array.vi".

Hope this helps, Guenter

Message 4 of 10
(3,035 Views)

Ok! It kind of works now, lol! When it takes the screenshot, it places it in the first (index 0) position in the array. The weird part comes when you take another screenshot. It does not place the picture in the next position in the array, it places it within the screenshot's array as if the thing were a smaller monitor! AHHHH!!! Reminds me of an Escher painting. Or an infinite mirror thingy. Eeeep!

0 Kudos
Message 5 of 10
(3,016 Views)
No. You did it correctly in the upper loop. All you had to do was something similar in the lower one. Something like the attached. Your VI has other problems. Your lower loop had a false constant wired to the while loop termination. How could your VI run? Do not use the run continuous button on the toolbar! That is not the correct way to keep a VI running. Use that only for debug purposes.
Message 6 of 10
(2,965 Views)
The false constant on the while loop was used just for debugging. So much for removing bugs; Check this out. It treats index 0 in the array as a small front panel, not as an image. It does take successive screenshots, but try it and see what it does. Watch index 0 carefully.
0 Kudos
Message 7 of 10
(2,936 Views)
I would suggest you use the Build Array and shift register like I did. With your technique, you are not adding images to the array.
Message 8 of 10
(2,917 Views)
Your code does the same thing mine does when I run it. The issue is that where the VI should add another picture to the array *located at the next successive index* (It places the first one just fine once the width/height is set to 195/140 in the property nodes.), it treats index 0 as a small front panel. Where the image of the front panel is in the array, if you capture a second image, the VI places it in the first image's image of the array, not the next index of the array like it should. Have you ever held a mirror facing another mirror, with their faces parallel? This VI does that for some reason.
0 Kudos
Message 9 of 10
(2,909 Views)
I do not see the problem you describe. I have simplified the program and used front panel controls because I do not have your custom menu. When I run it, every time the capture button is pressed, a new image is added to the array.
0 Kudos
Message 10 of 10
(2,897 Views)