LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conversion of array size to integer

hi all,
i am new to LabView,
i encountered a small problem with conversion of "array size" number to integer.
What i am having is an array, of unknown size, and now i want to access
all the elements in it.
For this iam using a while loop whose condition can only be checked by converting the size of
array to integer, plz do help
 
regards,
santosh
Regards,
santosh
0 Kudos
Message 1 of 8
(3,967 Views)

Hi Santhosh,

I am not sure if I got your requirement correctly. Anyway take a look at the picture with a for loop and a while loop concepts for handling arrays. The for loop with auto indexing enabled will let you use one element by one on each iteration (automatically). For this you do not have to worry about knowing the array size. For the while loop you can use the Array Size function available at function pallette All Functions->Array->Array Size. Please note that the array used here is 1D only. For 2D or 3D you need additional stuff.

Hope this helps.

Please post a picture of your vi so that you can get a better help from here...

Deepu.

0 Kudos
Message 2 of 8
(3,958 Views)
Hi,

I don't know if I unterstand you correct but if you are using the 'Array Size' function the type is already an Integer (Int32). You can also use a for loop. Connect your array to the for loop and in the loop you can access the elements of your array. Therefore you don't need the 'Array Size' function.

Hth

--
Joachim
0 Kudos
Message 3 of 8
(3,958 Views)
If I understand correctly, you want to monotor the size of a given array.

Simply use the "Array size" function (found on the array palette) which will tell you how many elements are in the array.  Bear in mind that a multi-dimensional array will return an array of values representing the different dimensions of the array.

As previously mentioned, this returns an I32 whish represents the no of elements in the array.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 4 of 8
(3,951 Views)

hi shane,

u got it right, after posting the message i again checked my data

and found that it is a multi-dimensional array. Since i was trying to use this value

for comparing with integer, iam facing problems. could u sort it out by explaining How

can i convert this "Array Size"value(returned by multi-dimensional array) to integer.

regards,

santosh.

Regards,
santosh
0 Kudos
Message 5 of 8
(3,939 Views)
hi,

you can only get an integer out of it if you have an 1D array or you access an 2D - ND array via the Index Array function. To use the function correctly you have to know the index.

Maybe you can attach the vi with the multidimensional array.

hth

--
Joachim
0 Kudos
Message 6 of 8
(3,930 Views)
It all depends on what you want to compare.

If you want to compare the overall number of elements in the entire multidimensional array, then simply multiply the 1D array by using the numeric function "Multiply array values".

This gives then an integer with the TOTAL number of elements in the array.

If you need a sub-set of the array, then you need to know which part of the array you are interested in.  Connect it to an indicator and have a look at it to determine the parts you want.  The 1D "size" array order is the same as the order on the indicator (top to bottom I believe).

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 7 of 8
(3,926 Views)
Hi Santosh,
 
See if the attached picture helps...
 
Regards
Deepu
Message 8 of 8
(3,916 Views)