LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dividing Curves with for loops and arrays

Solved!
Go to solution

Greetings,

 

   I am given a waveform and I need to divide the curve so that it consists of three segments, with each segment beginning at one peak value and ending at the next using for loops and arrays.  I also need to Combine these in a 2D array and plot the waveforms.

 

   I am stuck on how to do this. I attached my code.

 

  Can someone give me any ideas?

 

   Thanks!

   TheLT

0 Kudos
Message 1 of 6
(2,807 Views)

Just so you know, each row in the 2D array will have to be the same length.  Just saying you might have some extra 0s in some of your waveforms when you turn it into a 2D array.

 

Well, you already have the peak locations.  I would use the "Round to Nearest" and then convert to an I32.  Now you have a set of array indecies.  To get your subarrays, use the Array Subset.  The index input should be x[i] adn the length should be x[i+1]-x[i].  I'm using x as the array of indicies of the peaks.


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 2 of 6
(2,788 Views)

crossrulz,

 

   Thanks for the reply and apologies for not getting back sooner. Would the "round to nearest" go in the for loop? Or is this outside?

 

  I'm still kind of confused on what to do here.

 

   Thanks!
    Jesse

0 Kudos
Message 3 of 6
(2,775 Views)
Solution
Accepted by topic author TheLT

I'm picturing something along these lines.


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
Message 4 of 6
(2,771 Views)

crossrulz,

 

  Again sorry for the late reply. Thanks for your help so far. Do you know how to perform a ‘time dilation’ on the output received to that each there is say 100 points instead of 60? Did you ever hear of anything like that? Does that involve a for loop in the orginal for loop?

 

  Thanks!
    TheLT

0 Kudos
Message 5 of 6
(2,763 Views)

Also, please let me know if I need to open a new post or, since it relates to the same code, if it would be appropriate to leave this one open.

 

 Thanks!

   TheLT

0 Kudos
Message 6 of 6
(2,762 Views)