07-28-2016 05:06 AM
Hello. I am using LabVIEW 2013. I need to write values to an array and show the updated values after evey iterartion. As in, after every iteration you can see the latest value added to the array along with the others. I want to use this in my code for lap timing where I can show timestamps of previous laps. I am attaching a VI you can use to demonstrate which has natural numbers that keep getting updated.
07-28-2016 05:39 AM - edited 07-28-2016 05:42 AM
Hi deepen,
there is no array in your VI…
I need to write values to an array and show the updated values after evey iterartion.
Do you need to append values or do you want to replace existing elements?
To append you should use BuildArray, for replacing elements ReplaceArraySubset. And store the array in a shift register…
Simple example, made from your attachment:
07-28-2016 05:49 AM
Oh. I'm sorry about that. Also, I tried the VI you posted, It doesnt seem to work.
07-28-2016 05:51 AM - edited 07-28-2016 05:52 AM
Hi deepen,
your VI would work if you would do the same as me. But you didn't…
(You forgot a constant at InitArray!)
It doesnt seem to work.
The next time you want to describe a problem you should write more than just "doesn't work"…
07-28-2016 05:59 AM
Oh. Okay. No but you see the thing is, the dimension of my array is going to be unknown.
And by this VI, all the elements of the array get the same value, I need it to be like 1 then below it 2 then 3 .. etc. New value is added and the previous values are seen too
07-28-2016 06:06 AM - edited 07-28-2016 06:06 AM
Hi deepen,
the dimension of my array is going to be unknown.
As LabVIEW requires to know the datatype at edit time the array dimension WILL (HAS TO) be known!
And by this VI, all the elements of the array get the same value
I used InitArray because YOU already had it in your VI!
I need it to be like 1 then below it 2 then 3 .. etc.
Use a loop with an autoindexing output!
New value is added and the previous values are seen too
Use BuildArray to append elements to an array. Don't forget to limit memory usage then…
07-28-2016 06:21 AM
I'm sorry but I just can't get it to work. Here's what I tried. The other things I tried gave me the folowing output
Only the first element is replaced with new numbers
07-28-2016 06:29 AM
Hi deepen,
it seems you need to learn the very basics of LabVIEW: THINK DATAFLOW!
- Your "Array" will never update as the loop never stops and so "Array" never gets any data.
- You only increment the scalar value in the shift register, but no array data.
- You only create an array consisting of just one element using the BuildArray function.
- You don't store any array data in the loop. To store data in loops you should use shift registers!
- If the loop would finish you only output the result of the last iteration due to the output tunnel mode…
Did you take the free online courses offered by NI on their website to help beginners learn LabVIEW?
07-28-2016 01:48 PM
I understand what you're trying to say. BuildArray will create an array of just one element. That's where my problem lies. I need to create an array of multiple elements and it has to be updated after every iteration. The whole purpose is to be able to display the lap times. Like the first lap was completed at 12 seconds, so the first element is 12, then the second lap is completed after another 10 seconds, so the second element is 22.. etc. How can I do that ?
07-28-2016 01:52 PM
No. Look at the help for Build Array. Yes it will add a dimension to an array turning a scalar to a 1-D, or a 1-D to a 2-D, if you only have one input.
But drag the border up or down, and magically now you can put a new element at the front or end of the array. Also be sure to look at the right click menu for options such as turning on concatenation or not.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours