07-01-2021 08:41 AM - edited 07-01-2021 08:41 AM
I am pulling an index value from a device that is connected to a usb, I am then saving that value to a file (along with some arrays from other devices). I wrote a piece of code that appends the index to an array, but I keep just getting an array of zeros from the saved file. I can share more of the iv, but the value from the device is pulled and stored as an internal variable x/y. Then in the for loop an array is initialized and it appends the x/y variable to the bottom of the array. I should also mention that outside of the for loop everything is encased in a while loop.
07-01-2021 08:52 AM
Remove the empty array wired into your For loop and simply use auto-indexing for the output terminal of the For loop to build the array.
With respect to your original question the reason the array is because the output for your array terminal is set to last value. In addition, insert into an array must have a non-empty array in order for it to work. So, if you don't allow the For to automatically build the array you would need to replace the array terminals with a shift register and then replace the Insert Into Array with Build Array.
07-01-2021 08:53 AM - edited 07-01-2021 08:54 AM
Hi Bert,
please take those "Training resources" offered at the top of the LabVIEW board!
All those items shows missing LabVIEW basics…
07-01-2021 08:53 AM
Three problems:
1. You have a race condition because of your local variables. The X/Y variable in the loop probably gets read before data gets written to it in the left part of your picture.
2. Only the last iteration of that For Loop matters because you used regular tunnels. So "inserting" an element at index 999 of an empty array is going to give you an empty array. Those input and output tunnels for the array should be a shift register.
3. Don't use "Insert Array" when you want to append and element to the beginning or end of an array. You should be using Build Array.
07-01-2021 10:05 AM - edited 07-01-2021 10:09 AM
As others have said, if you want help, attach your VI. We cannot debug truncated pictures. (With limited exceptions!)
In this case however, your mistakes are so glaring that we can primarily tell that you need to do some training first.
07-19-2021 11:52 AM
I am still having an issue of getting the frequencies of all the daq systems to match up. I will get periodic rows of zeros in the outputed text file. I attached the vi to see if you could help me out. Basically I have six devices that are connected via usb/ethernet: an x,y,z motioned controlled stages, two eddy current sensors to measure displacement, and finally a load cell. The load cell is what I am having difficult matching up the frequencies of all the other components. For the x,y, and z stages there are supplied modules to set the velocity, tell the stage to move, and record the position of the stages (I have taken all these modules and imported them into the iv). Then for the eddy current sensor, the company already supplied an iv to set up communication and record the displacement readings. The company with the load cell doesn't supply anything and thus had to create my own. Please let me know if anything becomes apparent
07-24-2021 11:40 AM
Ah, what a mess. So much very questionable code (see below*). Can you point out where the "load cell" parts are on the diagram? We don't have your hardware or drivers. Maybe you could make a small VI that simulates the problem parts without hardware.
*examples (just the tip of the iceberg!):