From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, 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: 

Array clustering according to timestamps.

I have a 6D array with 1 row having the following format:

Flow Rate | Flow Rate TimeStamp | Mean Arterial Pressure | Mean Arterial Pressure Timestamp | Beats Per Minute | Beats Per Minute Time Stamp



What I need to do is find the Flow Rates / MAP's / BPM's that are closest to each other in meausurement (timestamp) time and recreate the same array but sorted that way.

 

How could I go about this in LabVIEW? 

0 Kudos
Message 1 of 4
(195 Views)

Hi Alain,

 


@alainschaerer wrote:

I have a 6D array with 1 row


Please explain the term "row" with respect to your 6-dimensional array!

 


@alainschaerer wrote:

Flow Rate | Flow Rate TimeStamp | Mean Arterial Pressure | Mean Arterial Pressure Timestamp | Beats Per Minute | Beats Per Minute Time Stamp

What I need to do is find the Flow Rates / MAP's / BPM's that are closest to each other in meausurement (timestamp) time and recreate the same array but sorted that way.


Hopefully you have a 2D array with 6 columns!

  • You want to sort a 2D array by one column? Isn't there a ready-to-use function in the array functions palette? (Yes, there is a VIM in my LV2021 installation…)
  • You want to compare a timestamp with your column of timestamps to find the closest index? What about subtracting the timestamp from the 1d array of timestamps and finding the value closest to zero ( which is the same as the minimum of that absolute values of the differences)!?
Best regards,
GerdW


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

Yes, my row has 6 columns.

"You want to compare a timestamp with your column of timestamps to find the closest index? What about subtracting the timestamp from the 1d array of timestamps and finding the value closest to zero ( which is the same as the minimum of that absolute values of the differences)!?"

Im not sure what you mean by that. Could you elaborate?

Would I convert the array into 3 1d arrays of timestamps and then find whichever are closest to each other by subtracting all of them with eachother: abs(timestamp1 - timestamp2 - timestamp3) and then optimize for the ones that are closest to 0?

If yes, how would I do that in labview and how would I then rearrange the original array?

0 Kudos
Message 3 of 4
(179 Views)

Hi Alain,

 


@alainschaerer wrote:

Yes, my row has 6 columns.


So you have "just" a 2D array of values - in contrast to your first message where you claimed a 6D array?

 


@alainschaerer wrote:

"You want to compare a timestamp with your column of timestamps to find the closest index? What about subtracting the timestamp from the 1d array of timestamps and finding the value closest to zero ( which is the same as the minimum of that absolute values of the differences)!?"

Im not sure what you mean by that. Could you elaborate?

  1. You index the timestamp column of interest from your 2D array, so oyu have a 1D array of timestamp values.
  2. You subtract your "timestamp of interest" to compare from that 1D array and take the absolute value of the resulting 1D array.
  3. You use ArrayMinMay to find the minimum value/index in this 1D array.

Now you have found the index closest to your "timestamp of interest". (Simple math!)

 


@alainschaerer wrote:

Would I convert the array into 3 1d arrays of timestamps and then find whichever are closest to each other by subtracting all of them with eachother: abs(timestamp1 - timestamp2 - timestamp3) and then optimize for the ones that are closest to 0?


Please provide an example VI with an example array of values.

Please provide a "timestamp of interest" also - and provide an expected result for all your required results!

 

(When providing your VI take care of downconverting for older LV versions in case you use a recent LabVIEW version. I prefer LV2019…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(169 Views)