10-04-2021 06:25 AM
Hi GerdW,
I see only one sub-vi is missing in your snapshot, you can refer to the file shown as the picture below first.
I will modify my vi files by your command and upload again later.
Thanks~
Ray Hsieh
10-04-2021 11:30 AM
Hi GerdW,
I have modified my VIs.
Refer to the attachment - Question.zip, please.
Thanks.
Ray Hsieh
10-04-2021 02:12 PM - edited 10-04-2021 02:19 PM
Hi Ray,
@rayhsieh wrote:
I have modified my VIs.
Refer to the attachment - Question.zip, please.
No, you did not modify your VI…
Refer to the attachment, please!
10-04-2021 08:27 PM
Hi GerdW,
First of all, really thanks for your correction~
Compared with you and other experts here, I'm a Labview beginner.
As a result, I'm not so clear that how to implement my purpose with smarter methods or experiences.
Here are response to your correction in the last post
Finally, is there any idea about using a global array with enough size instead of build array vi?
10-04-2021 08:40 PM
Hi Dobrinov,
Do you have some more concrete indications about your suggestion, such as code corrections?
I have uploaded the latest code, Question.zip, earlier, please refer to it.
Thanks~
Ray Hsieh
10-05-2021 09:17 PM
Hi everyone,
I find a discussion about global array, shown as the following
Example on how to set an array as a Global Variable (LV2?). - NI Community
I have downloaded and seen the example from @Mads & @JB.
According to these example, it seems that global array can be only constructed by For loop, shift register, case structure, Array subset.vi, and Replace array subset.vi, right?
So the memory usage can be decreased by these method?
Ray Hsieh
10-06-2021 03:06 AM
@rayhsieh wrote:
Hi everyone,
I find a discussion about global array, shown as the following
Example on how to set an array as a Global Variable (LV2?). - NI Community
I have downloaded and seen the example from @Mads & @JB.
According to these example, it seems that global array can be only constructed by For loop, shift register, case structure, Array subset.vi, and Replace array subset.vi, right?
So the memory usage can be decreased by these method?
Ray Hsieh
I'd have a look at DVRs (Data Value References) instead if I were you. They offer a lot of nice protection of the data within and are the best option to combine with the in-place structure to process that data. You can pass the DVR reference itself around in any way you like too.
Start with your final array, the way you want to save it somewhere, initialize it in that size, but empty, and then train to fill it up with the corresponding data one iteration at a time.
10-06-2021 03:19 AM
Hi Ray,
@rayhsieh wrote:
- Hide the labels of subVIs/functions. Use the context help window when you don't know them!
- Ans: Yes, I have already tried this way. However, I have searched lots of on-line information related to the issue but still feel confuse about how to implement to my system. Such as the advice, from Dobrinov, about not using "build array.vi" and initialize a global array at the beginning of the main vi.
Showing/hiding the labels of functions is not related to your problem. Showing those labels only clutters the blockdiagram - you still can read that information in the context help window!
@rayhsieh wrote:
- Cleanup the block diagrams! (Cleanup the frontpanels, too…)
- Ans: I'm not sure about this correction. I have tried to clean up my code by creating sub-vis, less data lines, less indicator and less control in front panel. However, there are some indicator & control must used to transfer data between two sub-vis.
Yes, controls/indicators are needed. But you can still align them nicely on the blockdiagram as I did with some of your VIs!
You should NOT maximize windows (frontpanel, blockdiagram) to full screen, that's only annoying.
Cleaning up code helps to maintain readability!
@rayhsieh wrote:
- Remove Rube-Goldberg constructs…
- Ans: This correction is a little brief for me. Can you describe this correction in a more clear way?
- Don't set subVIs to reentrant for no good reason!
- Ans: Do you mean not using shift register?
There's a whole long thread dedicated to Rube-Goldberg code in the "Special interest" section of the forum. Read it…
Setting a subVI to "reentrant" has NOTHING to do with using shift registers (or feedback nodes). You always should take care of initializing them correctly - or take care of the amount of data stored within…
@rayhsieh wrote:
Finally, is there any idea about using a global array with enough size instead of build array vi?
I don't see a reason to have a "global" array here. Why do you want to put even more data into memory?