LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array assigned to a shift register on a while loop

Solved!
Go to solution

I am a LabVIEW novice trying to understand legacy code (32-bit version of LabVIEW 2017). I had 2 basic questions about reading a block diagram. In the screenshot below, 'Mystery' is a 2D array connected to a left shift register of a While loop box.

1) What exactly is getting assigned to Mystery, perhaps all the values that are output by the While loop?

2) Mystery is made up of 2 blue vertically stacked boxes on the left with vertical double arrows, and one blue box on the right, with zeros in all 3 boxes. What does all that mean? I know blue means it's numeric, and the double line means it's a 2D array. But why are there 3 boxes?

colorimeter_2-1708017378021.png

 

 

0 Kudos
Message 1 of 5
(436 Views)

This is an empty 2D integer array constant. I assume that rows will be appended somewhere to grow it.

 

Currently, you see one element, but since the size is zero, the element is greyed out. You can resize the array container to show more elements. The two "boxes" on the left are the indices that allow you to define which element is shown in the upper left corner. You could also show the scrollbars, useful if the constant already contains many values. Remember that container size is independent of array size.

 

A pair of shift registers is basically a data storage location where you read from the inside of the left side, modify the data, then write it back to the shift register terminal on the right to update the value(s) held in the shift register. Optionally, you can initialize it with a defined value (empty array in this case), but you can also leave that unwired and the shift register will retain the last values when the loop is called again, a fantastic feature, especially useful for action engines (look it up!).

Message 2 of 5
(411 Views)

These concepts are the very basics of LabVIEW so if you want to move forward with it, I would heartily suggest you take advantage of the numerous learning opportunities available for free.

 

Start here:  LabVIEW Tutorial (ni.com)

 

Follow up with the links at the bottom of that tutorial, then just search "LabVIEW basic tutorial" and you will find all the info you could ever hope for in web pages, videos and PDFs.  Also, don't forget that LabVIEW has built-in examples that are a great way to see how thing are done.  Help > Find Examples...

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 3 of 5
(385 Views)
Solution
Accepted by topic author colorimeter

@colorimeter wrote:

I am a LabVIEW novice trying to understand legacy code (32-bit version of LabVIEW 2017). I had 2 basic questions about reading a block diagram. In the screenshot below, 'Mystery' is a 2D array connected to a left shift register of a While loop box.

1) What exactly is getting assigned to Mystery, perhaps all the values that are output by the While loop?

2) Mystery is made up of 2 blue vertically stacked boxes on the left with vertical double arrows, and one blue box on the right, with zeros in all 3 boxes. What does all that mean? I know blue means it's numeric, and the double line means it's a 2D array. But why are there 3 boxes?

colorimeter_2-1708017378021.png

 

 


  1. That is an empty numeric array. It is a common practice to initialize an array as empty to insure the array is cleared on startup. While that may not be as important on compiled applications it can be important during the development process so you don't start with stale data from the last run still in the array.
  2. A 2D array has rows and columns so there is a control for both plus the array itself.
========================
=== Engineer Ambiguously ===
========================
Message 4 of 5
(376 Views)

@colorimeter wrote:

2) Mystery is made up of 2 blue vertically stacked boxes on the left with vertical double arrows, and one blue box on the right, with zeros in all 3 boxes. What does all that mean? I know blue means it's numeric, and the double line means it's a 2D array. But why are there 3 boxes?


As already mentioned, the 2 left boxes are the index of a 2D array you're looking at, the the right one that indexes value.

You can r-click on it and select Visible Items -> Index Display to hide it for slightly less clutter on the diagram. I like to do that, the greyed out number is enough information that it's an empty array.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 5
(311 Views)