LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating Array after receiving number of values in while loop

Hi

Since i am new to Labview i hope i can find some help here.

I am reading values from the tcp server continously in while loop,but i wanted to build an array after i receive 13 values from the server i mean after 13 iterations later i have to bulid 1D array with this values  and then add this array to 2D array.can anyone help me how can i do this??

0 Kudos
Message 1 of 25
(3,936 Views)

chadalawada wrote:

I am reading values from the tcp server continously in while loop,but i wanted to build an array after i receive 13 values from the server i mean after 13 iterations later i have to bulid 1D array with this values  and then add this array to 2D array.can anyone help me how can i do this??


You need to be much more specific in the description. It is typically easiest to add a small VI showing the problem, so please do so!

 

I assume you start building the array of 13 vaules when you receive the first element and not after 13 iterations. (where would you keep the historc values?)

 

The sentence "add this array to 2D array" is very ambiguous. Since the dimensions don't match, it is not clear at all. The word "add" typically means an arithmetic operation and will not work if you mix dimensions as you do here. Could it be you mean "append" to a 2D array instead? Does the 2D array have 13 rows or columns? Do you want to append a row or append a column? When will it ever end? If you do this forever, you will run out of memory.

 

Please explain!

0 Kudos
Message 3 of 25
(3,911 Views)

Let's assume you want to collect 13 values in a 1D array, then apend it as a new row to a 2D array. Here's one simple way to do it.

 

 

Download All
0 Kudos
Message 4 of 25
(3,905 Views)

Of course since the 1D array is of fixed size, it would be more efficient to operate on it in place, e.g. as follows:

 

 

Download All
0 Kudos
Message 5 of 25
(3,898 Views)

Thank you very much altenbach,It is exactly what i wanted thank you very much.

0 Kudos
Message 6 of 25
(3,865 Views)

Can i add time and date stamp to each and every row??

0 Kudos
Message 7 of 25
(3,862 Views)

@chadalawada wrote:

Can i add time and date stamp to each and every row??


Yes, of course! That would be a trivial change, have you tried?

Do you want the time stamp of the first element or of the last element in each row?

0 Kudos
Message 8 of 25
(3,853 Views)

Yes i have tried to buid another Array from from 1D array,but i am unablw to add string Data and time to this 1D array.I want to add Date at first column and time in second column for every row.

0 Kudos
Message 9 of 25
(3,848 Views)

Well, you cannot mix datatypes in an array, so if precision does not matter, you could build a string array and format the various fields according to the data.

0 Kudos
Message 10 of 25
(3,840 Views)