LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Manipulation

Solved!
Go to solution

Looking for help.

Need to manipulate array input to expecting Array out.

Conditions are

1)if any channel data repeating latest data of that particular channel should be present in Array out.

2)Final result should be sorted in ascending order as mentioned in Array out

 

thanks in advance.

0 Kudos
Message 1 of 8
(1,261 Views)
  • With "sorted" do you mean sorted by channel?
  • Do you really only have LabVIEW 2018 or did you save for previous? (If you have 2019 or newer, a very clean solution would be using maps!!)
  • With repeating, are you talking exclusively about duplicated of the channel number or duplicates of the data. Obviously, the data for channel 48 is not repeating but differs in offset and voltage.
  • Why would you place two identical file read function on top of each other?
  •  
0 Kudos
Message 2 of 8
(1,235 Views)
Solution
Accepted by topic author gowthameie

The problem with your desired output is that hex "0017" does not even occur in the input, there is just "17". These are different using string comparisons, of course.

 

If I correct the input to 0017, here's one possibility:

(See if it makes sense. I am sure it can be simplified further. There are many ways to do this. We also assume that the input is clean, else some sanity checks are needed)

 

 

altenbach_0-1647188310561.png

 

0 Kudos
Message 3 of 8
(1,230 Views)

Hi Altanbach

 

1) My application is belongs to LV2018. So there is no option to use Maps and Sets function. 

2) Sorting meant, if test carried for channel no 17,48,1. The result should be in ascending order 1,17,48.

3)You assume Repeated test on one particular channel "n" times,  latest data of that particular channel (one data) alone should be present in array out. 

4) Don't worry about result data is better/ not better than previous time, latest (last ) data would be  in array out

 

Pls refer the image of data of individual channel.. 

 

Thanks on advance


 

0 Kudos
Message 4 of 8
(1,221 Views)

My example above should do exactly all that.

0 Kudos
Message 5 of 8
(1,211 Views)

Functionality is Fine.

Few bugs are there if i try to change the follwing items :

1) No. of Rows per channel data as  control variable (19 instead of 1)

2) Index value for finding the channel number as control variable (6 instead of 5), 

i will sortout the bu and update the working code for your reference.

 

Thanks a lot.

0 Kudos
Message 6 of 8
(1,181 Views)

When i try to change number of rows per channel, the following issues were found

 

1)Sorting is not in prober

2)Array Size is Changed

3)Few Channel Elements are deleted

 

Note: I assumed No.of rows/channel is 19 and Index of Channel Number is 5

 I attached Data, Code and Snippet for your reference

Download All
0 Kudos
Message 7 of 8
(1,152 Views)
  • You have 21 (not 19!) rows per channels (and missing two empty rows at the end of the input). For that reason, we should round up so the last reading is not truncated.
  • Your index control belongs before the loop. It should not be changed during the run and all results would be random once you would. The compiled code is much more efficient if the control does not need to be read with each iteration but can be constant folded during the loop.
  • Pleaser don't maximize the front panel to the screen. It's just plain annoying to stare at mostly grey background. 🙂

 

altenbach_0-1647270385522.png

 

0 Kudos
Message 8 of 8
(1,134 Views)