LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an Array

I have what I think is a very, very simple question that I just cannot figure out or find any information on. 

 

Below is a snapshoot of the block diagram for a simple piece of code I’m using to figure out how to store integer values into an array (which will be used later in a XY Graph).

 

http://i.imgur.com/KRhT7.png

 

When the program starts, I it to start creating an array of random numbers. When I release the Reset Counter button, it should start the whole process over again.

 

I guess the more general question here is how does one go about placing values from an integer data line into an array (without using a For Loop with Auto Indexing).

0 Kudos
Message 1 of 9
(3,089 Views)

Not sure exactly what you want, but attached is how you would build a 10 elements array with a for loop and shift register.  Why do you want to avoid auto-indexing in a for loop?  Auto-indexing is so much mor efficient.  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 9
(3,084 Views)

Hi,

 

I am not sure what exactly is your doubt. Regarding how to make an array without using the for loop, the easiest method is to use shift registers and build array function. I have attached a VI. Hope this helps you..

 

Regards,


Nitzz

(Kudos are always Welcome, Mark as solution if it is the oneSmiley Wink)

0 Kudos
Message 3 of 9
(3,075 Views)

The project I'm working on is somewhat complicated, but I'll try to simplify it.

 

LabVIEW is talking with an Arduino micro-controller via a serial connection. The Arduino sending data back to LabVIEW in the form of a string that LabVIEW parces up into seperate values. From my parcer sub-VI, I have several integer data lines. Currently, these data lines are attached to dial indicators, and will display real-time readings. I want to be able to plot data lines against one another in a XY Graph.

 

The link below is a screenshot of the VI.

 

http://i.imgur.com/cNbif.png

 

You can see that, as of right now, the two sensors that I want to plot againt one another are just being feed directly into the Build XY Graph block. This will not work because the graph will only display the two current values, not the entire history of values. To fix this, I assume I need to have the values of each data line stored into an array. I want to avoid using a For-Loop with auto-indexing because I want to be able to control whether data is being put into the array (to prevent any memory issues). 

0 Kudos
Message 4 of 9
(3,073 Views)

Hi,

 

I think if you use shift registers and build that array and then pass it to the graph you can plot the full data. The build array will concatenate the data in each itrations to the previous data. The example above shows how to build array. I guess you already know how to do it.


Regards,

Nitz

(Kudos are always Welcome, Mark as solution if it is the one:smileywink:)

0 Kudos
Message 5 of 9
(3,070 Views)

I only have version 8.5; can you save it in an older version?

0 Kudos
Message 6 of 9
(3,061 Views)

Hi,

 

You will be able to open this in 8.5;)

 

Regards,

 

Nitzz

(Kudos are always Welcome, Mark as solution if it is the one:smileywink:)

0 Kudos
Message 7 of 9
(3,056 Views)

Perfect, I think I figured out how I'm going to go about doing this.

 

One last question; as a rule of thumb, about how much data can you store in an array before you'll fill up the allocated memory?

0 Kudos
Message 8 of 9
(3,030 Views)

Dear Shaun,

 

I have found some information that answers your question. Arrays needs contigous memory to be available for the data to be stored. According to a Devzone article found on the national instruments website

 

"Different versions of LabVIEW fragment memory in different ways. This changes the maximum array size you can allocate. In LabVIEW 7.x and later, you can typically allocate slightly more than 1 GByte in a single array. LabVIEW 8.x, due to its larger feature set, only allows a maximum array size of about 800 MBytes."

 

The title of the articel is "Managing Large Data Sets in LabVIEW". It was very informative. I hope that this helps.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
0 Kudos
Message 9 of 9
(3,009 Views)