11-04-2008 12:08 PM - edited 11-04-2008 12:11 PM
pacific wrote:Hence two arrays are required to replace the old point with a new point.
No, you can use "rotate array" and do things in place. 🙂
(Even easier, keep track of the current index and just read the oldest element before replacing it with the newest while leaving the other elements untouched.)
11-04-2008 12:30 PM
Thanks altenbach. I had not used the "rotate array" function before.
Do you see any advantage/disadvantage of using queues instead of arrays?
11-04-2008 01:36 PM - edited 11-04-2008 01:37 PM
pacific wrote:Do you see any advantage/disadvantage of using queues instead of arrays?
It really depends how much flexibility you need. Queues certainly have more overhead.
In the simplest case of a fixed history lenght, you could get away with a single in-place array, and an in-place structure as follows.
(the subVI does not even need a loop ;))
11-05-2008 11:18 AM
Hi Pacific,
Thank you for your help, I tried the FIFO example and it works very well. I'm also trying to make it with the array but it's more difficult than I thought.
Best regards,
Guangde
11-05-2008 11:22 AM
guangdew1 wrote:I'm also trying to make it with the array but it's more difficult than I thought.
That would be a good exercise and it should be very simple. What kind of problems are you having with this.
11-05-2008 11:26 AM
Hi Rob,
Thank you for your help. I tried but couldn't meke it work. I'm weak on the waveform subject. I have never used it before. It will be appropriate if you can point me to some materials to learn about this subject.
Best regards,
Guangde
11-05-2008 11:33 AM
Hi altenbach,
Thank you for your help. The graph you posted looks strange for me. Looks the function here you are using is Index Array, but I don't know how you can make it look that. Can you explain a little bit further?
Thank you and best regards,
Guangde
11-05-2008 11:48 AM - edited 11-05-2008 11:49 AM
What is your LabVIEW version?
If you have a newer version, you'll find this structure in the "Programming...application Control...memory control" palette.
Look for "In Place Element Structure". Check the online help for details.
If you don't have it, you need an "index array" and an "replace array subset" and a little bit more code. 🙂
11-05-2008 11:50 AM
guangdew1 wrote:Hi altenbach,
Thank you for your help. The graph you posted looks strange for me. Looks the function here you are using is Index Array, but I don't know how you can make it look that. Can you explain a little bit further?
Thank you and best regards,
Guangde
Are you using LabVIEW 8.6? I think you are refering to the "In Place element" structure in Altenbach's picture. If you have LV 8.6, go to Programming/Application Control/Memory control palette.
11-05-2008 12:14 PM
I think my problem is to move the array. Like the attached image, no matter I have the index input rotate from 0 to 9 or a fixed number of 9, it will not give me the right result. Pacific mentioned about keeping two arrays, maybe that's the solution but I haven't figured it out yet.
Thanks,
Guangde