LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need guidance in getting data from condition and while loop

Solved!
Go to solution

Hi,

 

Thanks for your reply. I need to calculate individual columns' average, which means individual channels' average, and those to DDT and from DDT are used to save data in .csv format. But I want to see the average of individual columns in the display...

 

 

kind regards

 

Hasham

0 Kudos
Message 21 of 61
(573 Views)

Hi Hasham,

 


@Hasham622x wrote:

those to DDT and from DDT are used to save data in .csv format.


I told you more than once how to simplify your code, but you keep that Rube-Goldberg.

Again: you don't need all those ExpressVIs!

 

Suggestions:

  • Learn (more) LabVIEW basics before continuing to implement more features to your VI…
  • When sharing code it helps us when you would downconvert to some older LabVIEW version. Most say "LV2021 or older", I prefer LV2019.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 61
(553 Views)

Hi,

 

I tried to do without Express DDTs, and it was giving one large column, and I needed rows and columns. Due to that, I used two Express DDTs VI. Without that, it was giving the one long column. If you could guide me on how I could calculate averages of individual columns from an array of data?

 

Kind regards

Hasham

Download All
0 Kudos
Message 23 of 61
(523 Views)

@Hasham622x wrote:

Hi,

 

I tried to do without Express DDTs, and it was giving one large column, and I needed rows and columns. Due to that, I used two Express DDTs VI. Without that, it was giving the one long column. If you could guide me on how I could calculate averages of individual columns from an array of data?


Don't transpose the input?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 24 of 61
(509 Views)

Hi,

 

Thanks for your reply. Yes, I tried that option, and in return, I was getting on one row. I am getting data from 4 channels (four columns) and 200 iterations (number of rows), so it should be an array of 4 x 200. So, after using express DDTs, I am getting the required form of data in a .csv file.

 

If you don't mind, could you please guide me on how I could calculate the average of each column (channel) and display it?

Once again thanks for your guidance.

Kind regards

 

Hasham

0 Kudos
Message 25 of 61
(497 Views)

Hi,

 

I tried your suggestion, and it's working. If you don't, could you please tell me about the average of individual columns of array data in LabVIEW?

 

 

Kind regards

 

Hasham

0 Kudos
Message 26 of 61
(482 Views)

Hi Hasham,

 


@Hasham622x wrote:

could you please tell me about the average of individual columns of array data in LabVIEW?


So you have a 2D array with several columns of data and you need the average of those columns?

Transpose the array, autoindex the rows in a FOR loop and use the mean function inside the loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 27 of 61
(477 Views)

Hi,

 

I tried to run by implementing the guidance you provided, but it is giving the current value of the channel within a conditional loop. Then I also put the mean function out of the while loop, and it gives wrong values like 2, 1, 3, 1, 1, 1.

 

I also attached both approach images with this message.

Kindly guide me.

 

Kind regards

Hasham

 

0 Kudos
Message 28 of 61
(470 Views)
Solution
Accepted by Hasham622x

Hi Hasham,

 


@Hasham622x wrote:

I tried to run by implementing the guidance you provided


Why do you need 3 ExpressVIs when I suggested to use a FOR loop and a (simple) Mean function???

What's wrong with my suggestion?

 

I repeat: "Transpose the array, autoindex the rows in a FOR loop and use the mean function inside the loop…"

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 29 of 61
(458 Views)

Sorry and I didn't introduce DDT express when I connected it with subVI. Then it is attached by default, and thanks for sharing the image.

 

Kind regards

 

Hasham

0 Kudos
Message 30 of 61
(450 Views)