LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using mean.vi on a 2D Array

Solved!
Go to solution
Hi, there i am using NI PCI-6025E card and using two channels for taking input. I am attaching the circuit diagram that i am using to make sure that you can understand the problem clearly. I have acquired, filtered and stored data successfully using BUILD TABLE express VI. But now the problem is that i want to take the mean of the readings that i have stored in the table. The table's output was in string format i first converted that into number format to take the mean but then i came to know that after conversion it is a 2D array where as the data i am getting is only 1D. I dont know why the BUILD TABLE vi gives the output as 2D array. Any how now i want to take the mean of this acquired data but the mean VI takes only 1D data to take the mean. Please tell me what do i need to do with it. Do i have to convert the 2D data into 1D or something else? & if i have to convert this 2D into 1D data then how?
0 Kudos
Message 1 of 7
(11,473 Views)

First, don't call it a circuit diagram. It's a block diagram. A circuit is a drawing of electronic components. A LabVIEW block diagram is programming elements.

Second, a table is always a 2D string array. Whether you choose to display only one column, it's still a 2D array. Since all you provided was an image and not the actual VI, it's impossible to know how you configured the build table express (i.e. if you chose to include the timestamps), but you can use the index array function to extract just the column of data you need. If you wire a constant to the column input of the Index Array function, you will get a 1D array out.

0 Kudos
Message 2 of 7
(11,468 Views)
ok sorry for calling it a circuit diagram its really a block diagram. I am attaching now the configuration of the table vi also. i have not included the timestamps with the data, in this case what i think is that i should attach a constant with 0 value to the INDEX ARRAY vi. is it right or i have to use some different constant.
0 Kudos
Message 3 of 7
(11,462 Views)
The mean value is just the sum of all elements divided by the number of elements.
 
For arrays of dimension 2 or greater, just use the folllowing code:
 
 
(operations shown are: "add array elements", "array size", "to double",  "multiply array elements", "divide").
 
 


Message Edited by altenbach on 01-29-2008 12:14 AM
Message 4 of 7
(11,449 Views)

thanks for all the help can you please help me in one more issue. What i want is that when i press the acquisition or start button then the programme should wait lets say 50sec and then start the acquisition only for 10sec and then stop. I can manage the programe to wait for first 50sec but how to make sure that the programe runs only for 10sec not more than that. Please help on this last issue. I hope to get responses like before.

 

thanks to all who helped me out.

kind regards take care.

0 Kudos
Message 5 of 7
(11,440 Views)
Solution
Accepted by topic author shami81
The code we've seen so far from your images has some serious dataflow problems, for example you have two stop buttons, but the "stop 2" is not read while the code is executing in the inner loop.
 
I suggest you rewrite your program from scratch and design it as a simple state machine. Now simply check the elapsed time to decide what state to enter.
 
Why don't you attach the code you have so far and hopefully we will be able to suggest a good solution. 🙂
0 Kudos
Message 6 of 7
(11,432 Views)
ok thanks dear now i am posting you the actual vi that i have built by now. Please tell me how to use state machine as i am very new to LabView. I have idea of state machine how it works but dont know how to use it in LAB-VIEW. I will be very thankful to you for all your help.
0 Kudos
Message 7 of 7
(11,427 Views)