07-27-2019 01:17 PM
Hi Friends,
I am working on a data acquisition project that needs a XY graph with multiple plots for multiple channels. Each channel has it own signal level, I want to graph them in original level and also to normalize the graph so that all plots start form point zero for comparison. The average of the first 10 graph data is used as baseline data, all other data are subtracted by the baseline average, and the result is used to replace the original data. So I used either "replace array subset" or "insert into array", however, none of them worked. please find attached VI.
I have three indicators before and after the replace array subset vi, highlighted with a red circle on block diagram, and also have a screenshot of the front panel's data view page showing data updating. The reality is the replace array subset stops updating at graph count 10, which is the end of baseline period, meaning no new data updating for graph after baseline. however, the normalized new data keeps updating with graph count increasing.
Thanks,
Gu
07-27-2019 01:50 PM
Your case 0 replaces the 5000x3 array with a 10x3 array.
07-27-2019 02:21 PM
Hi Paul,
Thank you for your prompt response. Yes, the initialized array is 5000X3, partial of it needs to be replaced for the baseline data, which is 10X3, the remaining is more than enough for accepting data after the baseline period. I am not able to figure out why the 5000X3 limit changed to 10X3 limit.
Do you have any idea to solve the issue?
Regards,
Gu
07-27-2019 03:19 PM - edited 07-27-2019 03:21 PM
In the second frame of the "0" case, you are autoindexing on the outer FOR Loop. try to use another shift register for the lower 2D array instead and maintain the 2D array across the two loops. The upper shift register there has no purpose, think about it.
This all seems way too convoluted. Why do you need so much code??? Why is there a 1000ms delay in an otherwise tight loop?
07-27-2019 06:03 PM - edited 07-27-2019 06:04 PM
Hello Dr Altenbach,
Thank you for your inputs.
1. I tried another shift register for the 2D array in the for loop and it does not allow data input after the changing, an error of array mismatch occurred.
2. I removed the top shift register, the offset value was not able to pass from 0 case to default case as the offset value is required to normalize all data after the baseline period.
3. I replaced the "replace array subset" with a "build array" in the default case, the program runs smooth and acceptable.
4. I changed the array size for normalized data from 5000 to 10, because the 0 case can change its size limit from 5000 to 10. Now a build array is used to append data after. I checked the two for-loops and their limits are 2 and 10, so I really do not understand why the 5000 limit can be changed to 10.
5. The 1000 ms and some indicators are just for easy troubleshooting.
I originally thought that you would be an application engineer working for NI on the NI forum as you have thousands posts over 15 years . I was surprised you are an ophthalmologist after clicked around and visited your web. I really appreciate your contributions to the forum using your precious spare time.
I started to use LabVIEW 2006 in 2006, but I only do LabVIEW program about once every two years when my work need. So, I need to learn it again each time when I do my programs. I am a chemist, not a programmer. so, convolution in my program is difficulty to avoid sometimes.
Thank you again for your time.
Gu
07-28-2019 01:55 AM
Instead of lengthy ambiguous descriptions, show us your new code.
It would still help to describe what the code is supposed to do overall instead of focusing on mechanical details that may, or may not, even be appropriate for the task. I still get the gut feeling that all this could be done much simpler. As an example, your inner two-frame flat sequence is completely unnecessary because the same execution order is already fully determined by the principles of dataflow alone.
One thing you need to remember is that if you are autoindexing several arrays on the same FOR loop, the smallest array will determine the number of iterations.
(Ophthalmologist is just a tile because I work in an eye institute. Nothing clinical in my work 😄 I started with LabVIEW 4, which had no undo function and used it almost daily since then. Experience only comes with time ;))
07-28-2019 03:42 PM
Hi Dr Altenbach,
Here below is the code attached. Yes, the flat sequence is not a must, I removed it. it was added while doing troubleshooting.
Best reagrds,
Gu