LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot data on a cartesian plane, with a twist.

If you reply to this thread, I'll get an email - so it'll get my attention - and I have some idea now what you are doing.  However, I'm really no expert, so there's no guarantee that my future advise will be helpful (of course, if I don't know what you are talking about, you can then just start a new thread with an update subject line I suppose).
0 Kudos
Message 11 of 24
(1,364 Views)
Same project, different function...

I have an OPC connection set up that pulls thickness values into a double precision array of data. The array consists of 560 measurements across the sheet (rows) and appox. 80 scans (columns) of data. I'd like first to average across each row of data. Then, I want a total average of all the data in my array to get a total thickness average across the sheet. Here is where I run into a problem. The array that I read in via the OPC connection is zero-filled on the top and bottom. The first 30 or so rows and the last 30 or so rows contain zeros. The number of rows with zeros varies each time I read in data. As a result, for my total average thickness of my data, I'd like to average all the non-zero numbers in my array.

After that, I'm interested in comparing the averages for each row with the total average thickness to get percent deviations across my sheet and plot that data on a line graph to get a thickness profile of the sheet.

Let me know if I've lost you. Again, your help is extremely appreciated.
0 Kudos
Message 12 of 24
(1,339 Views)
For the overall average, use the array size function to get the dimensions of the 2D array. Then multiply these two values and reshape the data into a 1D array. Sort the data to get the zeroes at the beginning, then reverse the array to put the zeroes at the end. Search the array for the first zero occurrence. Then split the 1D array at the first zero location. Then you can use the mean function to calculate the average.
Message 13 of 24
(1,334 Views)
unclebump, it would take me quite a while to figure out how to code that, but I completely understand you. Btw, someone else wrote the OPC code, and it works great. I still have no idea what I'm doing.

I was thinking of how to make this easier, though. After I average each row of data and save those values into a 1-dimensional array, I can average the middle 500 values and come close enough to a total average. It won't be incorporating every good data point, but that's alright.

I think I've got the algorithm down. Now, to determine the syntax...

0 Kudos
Message 14 of 24
(1,327 Views)
Hi Crazy,
 
Another method for the zeroes in your rows could be to grab the column size (No of  rows).  then for each row, index the row and do an average on the entire row.  If the row average = 0 then throw it away, else build it into a new array.
 
I am no expert but thats just how i would have solved that problem.  Uncle bump's solution is probably more efiicient.
 
Craig
LabVIEW 2012
0 Kudos
Message 15 of 24
(1,321 Views)
Post some data and I'll write the code.
0 Kudos
Message 16 of 24
(1,308 Views)
I noticed that, when LabVIEW pulls in the data using the OPC connection, it puts NaN (not a number) rather than the zeros at the top and bottom of my array.  Will this make the total average a little easier to obtain?

Here is a txt file that resembles what the array will look like in LabVIEW.
0 Kudos
Message 17 of 24
(1,304 Views)
To give you some idea of what I'm ultimately looking for...
0 Kudos
Message 18 of 24
(1,302 Views)

Try this in 7.0 format.

 

0 Kudos
Message 19 of 24
(1,279 Views)
unclebump,

that appears to be working very well. thanks alot and I'll let you guys know when I get to my next hurdle.


0 Kudos
Message 20 of 24
(1,257 Views)