07-31-2015 04:04 PM
I am trying to edit elements in a 2 d array while it is running. The array is going to be passing data to do a set of measurements, so the idea is that if I wanted to change the amount of measurements that I wanted to do, I would be able to change it. I thought putting it into a while loop would allow it to update, but it is not. any suggestion
Thanks,
Akshay
07-31-2015 04:13 PM
When you're passing a wire to a subVI, labview passes a copy of your initial array, not the array itself.
If you want a subVI to modify an array from a calling VI, you might need to pass the reference to your array, then your subVI can change its value and the change will be available in the calling VI.
Without reference you can use your subVI to take an array input and an output, so the calling VI will replace its copy from the subVI output.
Does it answer your question? If not please give more details on what your trying to do.
08-02-2015 07:15 AM
@fghfghgfhfhg wrote:
I thought putting it into a while loop would allow it to update, but it is not. any suggestion
This sounds like you need to learn how to use a shift register. If you just use tunnels, then once a value goes into the input tunnel, it cannot be edited. By using a shift register, the new values are updated each iteration of your loop.
08-03-2015 08:18 AM
thanks
08-03-2015 10:47 AM
Here is my code. What I am trying to do is get the B setpoints array to update while the program is running. I put in the shift registers, but it has not seemed to have worked the way I intended it to. Where am I going wrong? Running the code might not work, so I have included a screenshot
08-03-2015 11:11 AM
Ok, we need to talk through your requirements. You whole stop routine just seems outrageous. You also need to work on understanding data flow. So give us detailed description of exactly what you are trying to do.
08-03-2015 11:22 AM
Yeah I am working on my stop routine. What I am trying to do is create an array of current and magnetic field setpoints, and then use it to run a measurement. The program is supposed to take those setpoints and run the measurement, but also be able to update the array of magnetic field and current setpoints , just in case if wether or not an element was added to an array. After all the magnetic field setpoints have been meausered, including any extra setpoints that were added in while the program was running, it is suppossed to stop the while loop, and then initialize the instruments, and end the program.
08-04-2015 03:58 PM - edited 08-04-2015 04:08 PM
What are the functions of the two sub VI's on left of your program that are unlabeled? I'm still a little confused as to what your end goal is. Are you trying to insert elements into the current and magnetic field arrays based on the output of the sub VI's inside your nested loops? The logic on your stop buttons for the three loops can be cleaned up which will help improve the VI's readability.
Regards,
Kevin
National Instruments
Applications Engineer
08-04-2015 04:06 PM
@fghfghgfhfhg wrote:
The program is supposed to take those setpoints and run the measurement, but also be able to update the array of magnetic field and current setpoints , just in case if wether or not an element was added to an array. After all the magnetic field setpoints have been meausered, including any extra setpoints that were added in while the program was running, it is suppossed to stop the while loop, and then initialize the instruments, and end the program.
Honestly, that is a horrible work flow. Anybody running the test should be able to set up the test (put in all set points) and then tell it to run. From there, you just use a FOR loop to go through all of the set points, show the results, and then quit.
08-04-2015 04:26 PM - edited 08-04-2015 04:28 PM
@fghfghgfhfhg wrote:
Yeah I am working on my stop routine. What I am trying to do is create an array of current and magnetic field setpoints, and then use it to run a measurement. The program is supposed to take those setpoints and run the measurement, but also be able to update the array of magnetic field and current setpoints , just in case if wether or not an element was added to an array. After all the magnetic field setpoints have been meausered, including any extra setpoints that were added in while the program was running, it is suppossed to stop the while loop, and then initialize the instruments, and end the program.
It seems pretty pointless to try to fix your code. I would recommend to start from scratch after doing some LabVIEW tutorial.