From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to delete intermediary elements of an array

Solved!
Go to solution

Hello,

 

This is the signal i am taking and i would to  create a code to take an average in every peak of the pulse you see in the picture.I am not sure if this can be done.
For start my thought was to delete the values who are between 4 volts and 1 volt .I try to do a small code to do that but it seems that something i am doing wrong.How can i delete the values which are between 4 volts and 1 volt  in array?See the Vi i have done a tell me your opinion or propose the appropriate code please.
 
 
Download All
0 Kudos
Message 1 of 14
(2,648 Views)
Solution
Accepted by topic author gstathatos

Hi gstathatos,

 

it seems you should be reading that basics course offered by NI...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(2,641 Views)

Thank for the quick reply and the solution.The other question i have is if i can take an average in every peak of my signal?Can you propose a suggestion how this can be done.

0 Kudos
Message 3 of 14
(2,634 Views)

How will you determine which is the peak you want to take and average. If you use the Array Min and Max it will give you min (Least) and Max (highest) values but its pretty tricky to do what you want to achieve.  For instance if you know the number of cycle (If it is a standard wave) then you can divide the array into that many segments and find the min and max among them and then find the average of those values.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 14
(2,629 Views)

I would like to find the average when the voltage as shown in the graph is above 4 volts and also to take an average when the voltage goes below 1 voltage.I am not sure that i understand correct what you suggesting,can you please provide a code example to help me understand.

0 Kudos
Message 5 of 14
(2,621 Views)

I have done little modifications with GredW's code check it.

 

 Average_min and Max.png

 

Good luck

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 14
(2,612 Views)

Thank for your help but this is not exactly what i would like,let me explain, GredW's provide a code how to delete the intermediary values between 4 and 1 volts and now the array 2 has only values above 4 voltage and below 1 voltage,from these values of the array i want to calculate an average when the values of the array are above 4 and below 1.

0 Kudos
Message 7 of 14
(2,607 Views)

So you want the average of the entire array with the values between 1 and 4 removed?  If that's the case, just take GredW's code and put a Mean.vi at the end.  The VI is located in the Mathematics->Probability and Statistics palette.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 14
(2,593 Views)

Ha.. Yes Now I have modified that check. Still with that Idea you can try creating by your own that will be much helpful for you.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 14
(2,591 Views)

I post a picture which i think would help more to understand.In the picture you see the signal which is 1D array after the intermediary values where delete.The array 2 contains all the values.As you see in the picture i have mark the maximum and the minimum i want to find the average,so according to the signal (red cirlce in the picture the yelllow by mistake should be also red) we see that we have 9 peaks,that means that inside our array we have values which are above 4 voltage,so some how i must find them and find an average for each peak i have.The same for minimum (purple cirlce in the picture)  we see that we have 8 peaks that means that inside our array we have values which are below 1 voltage,so some how i must find them and take an average for each peak i have.

 

I hope this more helpfull now.

0 Kudos
Message 10 of 14
(2,584 Views)