08-11-2017 11:02 AM
Hi, I am new in this forum so my apologies if I am not posting this question in the proper place.
I need to read an array inside a for loop and display the values outside this loop. The .png attached is a simplification of my problem -the code is just a bit more complex... at least for me
Why does it work fine with Meter 1 inside the for loop but Meter 2 outside just reads the last values? I checked the tunnel modes. In every other mode I get a broken wire.
Sorry for the simplicity of my problem; I know my level is quite low but help is appreciated.
Regards
Solved! Go to Solution.
08-11-2017 12:09 PM
juanmg85 wrote:
I need to read an array inside a for loop and display the values outside this loop.
Sounds to me like you need an array indicator.
08-11-2017 12:11 PM
Turn on the "light bulb" and watch your code run in slow motion and ask yourself when does what data move from where to where?
Ben
08-11-2017 12:40 PM - edited 08-11-2017 12:51 PM
Dataflow dictates that an output of a function or structure (e.g. the loop here) is only available after the structure has completed. This is one of the core ideas of dataflow and I would strongly recommend you to do a few more tutorials before proceeding.
There are quite a few other things wrong with your code, for example:
(Next time, please attach the VI instead of a picture).
Here are two code that do bascally the same thing simpler. You only need to wire N in the rare cases where the array is larger, but you only want to operate on the first N points.
08-20-2017 04:32 AM
Thanks for your solution and all your tips, altenbach. I understood a few ideas I didn't know before.
The 2D array is 2D in the original code but yeah, in this simplification it wouldn't make sense.
Finally, I've done Core 1 and 2 courses at NI but since I do not work as a developer (but I need to use LabVIEW every now and then) I often lack of practice. Do you know if there is something like a exercises guide with solutions to practice specific topics?
Thanks again