LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Sort

This is your VI "unwrapped."  To me, this is easier to follow.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 11 of 22
(1,847 Views)

Hello,

 

In my attempt to implement your solution for my data set found in the text file, my "File Data to Sort" display does not mimic my actual text data.  If you take a look at my attempt,  the "File Data to Sort" display has the same LO for up to the 1247 index.  I only have 416 points. I am not sure what I am doing wrong?? 

 

Thanks,

hiNi.

Download All
0 Kudos
Message 12 of 22
(1,803 Views)

I'm not sure what you WANT it to do, but it's doing exactly what you TELL it to do. (It's often that way in this business 😉

 

The clue is in the relationship between those two numbers: 0..1247 = 1248 entries = exactly three times your 416 rows.

 

 

If I translate your code into words:

 

Read Spreadsheet file

Extract column 5  ;  416 rows

For each TEMP value                        ; There's only one: RM)

    For each LO Freq                          ; There are 8

        For each Test Condition            ;   ( Original, Tune 1, Tune 2)

            For each Measured value     ;  from Column 5 : 416 values

                Bundle TEMP, LO, TEST CONDITION, MEASURED

 

Notice the words there: For each LO freq, you have three TEST CONDITIONS, and 416 MEASURED VALUES for each TEST CONDITION.

 

416 x 3 = 1248.

 

It's doing exactly what you told it.

 

Note  that it will put the SAME 416 rows into all three TEST CONDITIONS (that data is 3 repetitions of your 416 rows).

 

That doesn't make sense to me now, but I'm not in your shoes, so I can't say that it's wrong.

 

You need to ask yourself how is the data organized?

 

Is it possible that the 416 rows are supposed to cover ALL of the TEMP cases, ALL of the LO cases, and ALL of the Test Conditions?

 

That doesn't quite add up, as you have 1 Temp x 8 LO x 3 test conditions, = 24 values

 

 

It looks to me like you have the data right there: the file itself says TUNE 2 in column 0, TEMP RM in col 1, and LO FREQ in column 3, with your measured data in column 5.

 

 

There is a discrepancy between what the file actually says, and what you are programming it to look like.  It's NOT following the FOR EACH parameters you are giving.

 

You should be reading the fle data into a single array, and bypass all that FOR LOOP stuff.

 

Like I said, the only purpose of the FOR loops in my code was to generate some simulated data.

 

But you have the real data right there in front of you.

 

Just read the 416 lines into 416 clusters, each cluster being { Col 0 | Col 1 | Col 3 | Col 5 }

 

THAT is your DATA TO SORT.  Then go into the WHILE loop, where you choose which way to sort it.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 13 of 22
(1,779 Views)

Hello,

 

I tried your solution but I do not think that it might quite help me out.

 

Attached is a minimal data set mirroring the actual data that I capture.

 

Test DUT Temp LO x-axis y-axis 1 y-axis 2
Original FIRST RM 168 100 3000 0
Original FIRST RM 168 500 3005 0.5
             

 

...

 

All the y-axis data is plotted against the fixed x-axis.  As you will note, the x-axis data is always fixed at 100,500 and 8000.

 

If I sort the data, then from the sort, if I select Original, First, RM, 168, 590, then this should be the data that selected:

 

Original FIRST RM 168 100 3000 0
Original FIRST RM 168 500 3005 0.5
Original FIRST RM 168 8000 3001 0.1
Original FIRST RM 590 100 3000 0
Original FIRST RM 590 500 3015 0.15
Original FIRST RM 590 8000 3025 0.25

 ...

Then I will should have 2 plots...

  1. One for LO = 168...x-axis = 100, 500, 8000, y-axis 1 = 3000, 3005, 3001,  [y-axis 2 = 0, 0.5, 0.1]
  2. The other for LO = 590...x-axis = 100...8000, y-axis 1 = 3000,3015,3025, [y-axis 2 = 0, 0.15, 0.25]

 The y-axis data is interchangable between y-axis 1 and y - axis 2.

 

If I now slect, Original, Tune 1, Tune 2, First, RM, HOT, 468, 590:

 

...

 

I will now have 12 plots:

  1. Six for LO =  468: 1 for DUT "FIRST" @ Test Original @ RM, 1 for DUT "FIRST" @ Test TUNE1 @ RM, 1 for DUT "FIRST" @  TUNE2 @ RM,  1 for DUT "FIRST" @ Test Original @ HOT, 1 for DUT "FIRST" @ Test TUNE1 @ HOT, and 1 for DUT "FIRST" @ TUNE2 @ HOT,
  2.  Six for LO =  590: 1 for DUT "FIRST" @ Test Original @ RM, 1 for DUT "FIRST" @ Test TUNE1 @ RM, 1 for DUT "FIRST" @  TUNE2 @ RM,  1 for DUT "FIRST" @ Test Original @ HOT, 1 for DUT "FIRST" @ Test TUNE1 @ HOT, and 1 for DUT "FIRST" @ TUNE2 @ HOT,

I hope that this can help in the understanding of the data sorting functionality that I would like to achieve.

 

I am planning to add more data for the other Temp (COLD), DUT "SECOND", Test "TUNE 3".

 

Thanks,

hiNi.

0 Kudos
Message 14 of 22
(1,717 Views)

I don't see the code you tried.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 15 of 22
(1,708 Views)

Hello Steve,

 

My first post has my original data set and "close to" working VI.

 

I wrote the previous post to help simplify my original data collection.  As I started to modify my original program to match up my previous post, the programming started to become more convulted, so please refer to my first post as the starting point.

 

I am sincerely hoping that I am getting closer to making my data set and what I want plotted clearer to understand. 

 

In my original post, I only have RM data and no DUT column. Columns 4, 5 and 7 are just extra data and not needed for my plots. 

 

Thanks,

hiNi.

0 Kudos
Message 16 of 22
(1,677 Views)

Tip:  You are doing way to much work around this:

Screen Shot 2015-07-10 at 6.36.48 PM.png

 

You are turning an item into a 1-D array, then a 2-D array, then a 3-D array, then a 4-D array (if the outer loop was enabled), then you turn the whole thing into a 1-D array.

 

Why?  If you want a 1-D array, then make a 1-D array, and be done with it.  Simply set the TUNNEL mode to CONCATENATING, and get rid of the RESHAPE ARRAY operation.  you have to pay extra attention to reshaping, to make sure it does what you want it to.  It's just an unnecessary chance to get something wrong, and it makes the CPU work harder.

 

 

ALl that aside, I still don't know what you want.  there is nothing in that diagram (dynamic plot3.vi) that even vaguely looks like an attempt at sorting.  I don't see one single comment, although I didn't look at everything.

 

I've showed you how to sort data by various criteria, the rules are simple:

 

--- Rebuild the data into clusters, with the primary key as the 0th element, the next key as the 1st element, etc.,  and the index as the last element.

--- Sort the array of these temporary clusters.

--- Go thru the temporary clusters, and use the index to access the original array elements. 

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 17 of 22
(1,668 Views)

@CoastalMaineBird wrote:

 

You are turning an item into a 1-D array, then a 2-D array, then a 3-D array, then a 4-D array (if the outer loop was enabled), then you turn the whole thing into a 1-D array.

 

Why?  If you want a 1-D array, then make a 1-D array, and be done with it.  Simply set the TUNNEL mode to CONCATENATING,


This is a good tip, because you will likely have empty cells.  A 2D array must have the same number of columns in all rows, and a 3D array must have the same number of columns and rows in every page.  Same with a 4D array.  Concatenating is what you want to avoide tons of empty cells that then need to be filtered out.

0 Kudos
Message 18 of 22
(1,578 Views)

Hello Steve,

 

Thank you for taking the time and your patience!  As I think more about this thread, I think that I should have named this, “Data Selection”.  Anyways, we are already neck deep in this thread, so let’s push forward.

 

I have made modifications to my initial program incorporating your suggestions.  I am now at a “what to do next” point.

I have included a spreadsheet showing the original data to extract from (this is the data that is found in the “data sorted” indicator in the LabVIEW program.  The other tabs in the spreadsheet show 4 test cases of my desired extracted data and plots.  They are as follows:

 

Test Case 1 (as found in the tab labeled, “Test Case 1” in the attached spreadsheet):

If I select: Original, DUT1, RM and 168.038 from the LabVIEW cluster, I should end up with the data block and single plot as shown in the excel tab “Test Case 1”.

 

Test Case 2 (as found in the tab labeled, “Test Case 2” in the attached spreadsheet):

If I select: Original, DUT1, Tune1, TUNE2, RM and 168.038 from the LabVIEW cluster, I should end up with the data block and the 3 plots as shown in the excel tab “Test Case 2”.

 

Test Case 3 (as found in the tab labeled, “Test Case 3” in the attached spreadsheet):

If I select: Original, DUT1, RM, HOT, 168.038, 463, 478,493, 422.58, 435.43, 448.228 and 460.899, I should end up with the data block and 16 plots as shown in the excel tab “Test Case 3”.

 

Test Case 4 (as found in the tab labeled, “Test Case 4” in the attached spreadsheet):

If I select: Original, Tune1, TUNE2, DUT1, RM, HOT, 168.038 and 422.58, I should end up with the data block and 12 plots as shown in the excel tab “Test Case 4”.

 

As you can see, the LO Freq is what I am comparing over different conditions.  All the plots are plotted against the audio freq column as designated in the LabVIEW.

Download All
0 Kudos
Message 19 of 22
(1,548 Views)

Hello,

 

Can you assist me in finally extracting the data  from the "sorted" array to plot based on the last post above?

 

Thanks,

hiNi

0 Kudos
Message 20 of 22
(1,456 Views)