â06-08-2020 11:45 AM
My VI reads 2 signals, one is a model and the other is a signal that will be read online (no EOF). The latter is read in chunks of 820 lines each. Each chunk is compared with the model after a preprocessing step (detrend, filter, decimate). It works now as I want, but it is very bushy and only read 4 chunks. The input signal is very long (having about 500 such sequences) and if I did a sequence for each of the 500 chunks, my VI would become even more complicated.
That's why I'm looking for a suggestion to help me simplify the block-diagram and at the same time to read more chunk.
Thanks in advance.
â06-08-2020 11:59 AM
I think you should go back to the tutorials and learn the basics of LabVIEW and dataflow. This is not it!
Your VI makes absolutely no sense! Why all that duplicate code and loops without purpose?
Also define words such as "online", "chunk", "sequence", "complicated", etc.
â06-08-2020 12:03 PM
What do you mean by "very bushy"? I have never heard that term in the context of programming before.
Please help us by cleaning up your VI.
Why did you turn all those subVI into "Show Terminals?". Go right click on each one of them, Visible, uncheck Show Terminals.
Make sure all of your block diagram terminals for controls and indicators have their labels shown.
Those two things alone make it impossible to look at your VI and deduce what you are trying to do.
It seems to me that you have 4 flat sequence frames all doing the same thing. What you want to do is take just one frame and wrap that in a while loop.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW
â06-08-2020 02:14 PM
I agree with the others, this is very hard to read.
First of all, as has already been stated, you do NOT need to duplicate all of that code. I think that was the basis of your question - you don't want to duplicate the code 500 times (or however many you need).
1. When you need to use the same code multiple times you use a loop. If you know the number of iterations prior to entering the loop then use a FOR loop. Otherwise you use a While loop and have a condition for Exit.
2. What is the purpose of the While loops in your code? They appear to just repeat the same calculations two times (unless the Stop button is True on the first iteration).
3. Wires should always go from left to right. This makes it much easier to follow dataflow.
4. Do you understand the concept of dataflow?
5. Please do show icons instead of terminal blocks for functions. It is much easier to see what's going on with icons. Also, you don't need to show those labels.
6. Please do show labels for all controls and indicators on the block diagram.
â06-09-2020 08:27 AM
Thanks anyway! I didn't even pretend to do it correctly in LV, that's why I turned to those who know it. I have previously tried several types of loops but I failed to read 820 lines in successive chunks. So I fragmented the reading of my signal into program sequences: reading the first chunk of 820 lines from 0 to 820, the second from 820 to 1640, the next from 1640 to 2460, and so on ... but always 820 lines (per iteration). I had to do more sequences (4 in this case) because otherwise, VI would read the same first 820 lines at each iteration.
I will take the courses indicated above.
â06-09-2020 08:38 AM
@AncD wrote:
I had to do more sequences (4 in this case) because otherwise, VI would read the same first 820 lines at each iteration.
I will take the courses indicated above.
Why would you have to read the first 820 lines at each iteration? Take 820, multiply by the array index, and use that as your starting index. You could then do as many groups of 820 lines as you want.
â06-09-2020 10:10 AM
@AncD wrote:
Thanks anyway! I didn't even pretend to do it correctly in LV, that's why I turned to those who know it. I have previously tried several types of loops but I failed to read 820 lines in successive chunks. So I fragmented the reading of my signal into program sequences: reading the first chunk of 820 lines from 0 to 820, the second from 820 to 1640, the next from 1640 to 2460, and so on ... but always 820 lines (per iteration). I had to do more sequences (4 in this case) because otherwise, VI would read the same first 820 lines at each iteration.
I will take the courses indicated above.
Go back and read my post here.