LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count the number of rows in an array

Hi there,

I'm quite new with Labview, maybe somebody can help me.
I have a .vi that controls two pump with certain ratios (to make a composition gradient). I export the data to an ascii file, which write the displacement of the two pumps in 2 colums. However, the number of rows is related to the ms-counter, and thus related to the processor of the computer. Now I need, at the end of the vi, to get the number of rows written to the ascii file, to do some further calculations. Does anybody know how to do this?!

Thanks
0 Kudos
Message 1 of 5
(9,054 Views)
Hi

One way could be to just simply increment a counter each time you write a row to the file.

If it's not that easy you maybe can provide more information about your problem (screenshot, some portions of your code, ...).

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(9,048 Views)
Well, it might be that easy I guess.
The problem is that I'm not sure how to do this. The data is collected in an array and after running the .vi, it is completely exported to an ascii file. Now how can I increment a counter each time that a new row is added to the array?
Just in case, I added the .vi file, although this is more a general question and not specifically related to this .vi
0 Kudos
Message 3 of 5
(9,047 Views)
Hi,
All you have to do is put a find array size at the end of ur loop,so by this you will know how many rows are present in the file.This function can be found in the ARRAY PALLET.If its a 2d array then it shall give you a 1D array as output so 1st element will be M and 2nd will be N,if the put put is 1D array then it will give you the size directly.
Hope this will help you

Cheers
vicky
0 Kudos
Message 4 of 5
(9,038 Views)
You could wire the loop-counter to a variable outside the loop, so you can see the number of iterations (don't forget to add 1).

You also can use the Array Size-Function. Here you get different outputs, according to the dimensions of the array to get the size of.
Here you can see what you get if you use this function:

1D-Array: one value
2D-Array: array, item 0 = number of rows, item 1 = number of columns
3D-Array: array, item 0 = number of pages, item 1 = number of rows, item 2 = number of columns

So if (in your case) you wire a 2D-Array you can use the array-size function, select item 0 of the array you get and you get the number of rows.

You can also have a look at the attachement.

Hope it helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 5 of 5
(9,036 Views)