LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Indexing into a Cluster of Arrays

Solved!
Go to solution

Hello Everyone,

 

I'm at a total loss at the moment with this one. I'm currently coding for a Pressure Transducer Calibration program and I need help pairing Pressure and Voltage data. If you look at my attachment "Front Panel", you can follow my line to where I want to insert a 2D array. (Note: That array will be from the "2nd" test series of arrays) 

 

You may also look at my "End Goal" to see where I'll be implementing this. I really appreciate this forum as it has answered many problems people face.

 

0 Kudos
Message 1 of 7
(2,408 Views)

Your code makes absolutely no sense.

 

  • Your shift register should be initialized.
  • You can delete the inner loops and nothing would change if you would use "number to fractional string".
  • There is a simple mathematical way to generate indices from [i] in the second loop. No need to autoindex on manual arrays.
  • I would keep it all orange and format into string at the very end.
  • There is no need for any 3D arrays anywhere!
  • In the third loop, the blue inputs are equal to [i], i.e. the same as you would be from autoindexing.
  • I think all you need is a single loop. Simplify!

Please take a step back and explain in simple terms:

  • what is the original data
  • How should it end up in the final data structure.
  •  
0 Kudos
Message 2 of 7
(2,392 Views)

Thank you for the reply, I'll go through your bullet list to address why I did somethings. (to clear it up)

  • I deleted that constant for that initialized shift register and forgot to put it back.
  • Even though it may be bad practice, I need to leave the inner loops to "process" the whole array; changing my count terminal (N) would change a lot in my code.
  • Will need to build my experience up for that.
  • Noted. This should still work even though I converted to string at the beginning. (more bad practice on my part)
  • 3D arrays I agree, shouldn't be in any part of code. (stay away!) I was able to index from it and got the "sets" I wanted.
  • Noted. Over looked that. (staring at this code for 3+days, trying to come up with solutions)
  • Noted. I'll look into that. (that won't fix my issue though)

See below for original data: (Note: 2 Test series; black box indicates one set and correspond the "0" from the blue 2nd test series.)

LawnMower3000_0-1595561424341.png

See below for "Theoretical" final data structure. (See above "Front Panel" attachment from original post to see what I'm getting)

LawnMower3000_1-1595562023942.png

 

 

Download All
0 Kudos
Message 3 of 7
(2,378 Views)
Solution
Accepted by topic author LawnMower3000

There are millions of simple ways to do this. Best would be to build the final data structure directly in the first array, of course.

 

But let's assume that the output of the first array stack has the give structure and we need to convert it to the final data structure. Here is one possibility, but I am sure there are even easier ways.

 

(It is a really bad idea to have multiple data with the same value, so I added the voltage to 500 for the second value.)

 

altenbach_0-1595566895846.png

 

0 Kudos
Message 4 of 7
(2,355 Views)

@LawnMower3000 wrote:
  • Even though it may be bad practice, I need to leave the inner loops to "process" the whole array; changing my count terminal (N) would change a lot in my code.

I never said anything about the count terminal. Compare the two code fragments below:

 

 

altenbach_0-1595567344474.png

 

0 Kudos
Message 5 of 7
(2,351 Views)

This is awesome @altenbach!

 

So I didn't mention this before but "Voltage Data" can change array size depending on how many Sensors (channels) are being calibrated during a full calibration run. Being that, the initial array will give the structure and that "500" (Pressure value) will match the array size (using that array size function implemented). 

 

I apologize for assuming you meant to change Format into Sting to Number to Fractional String; not the same thing.

 

Taking out that Count Terminal (N) for simulating "2 test series", Can you suggest a way to keep the previous iteration series of data? (making this a subVI, making input terminals for Pressure/Voltage data) Would a feedback loop work? Shift Register in a while loop? Going to be recording 10 test series up/10 series down. 

 

 

0 Kudos
Message 6 of 7
(2,334 Views)

Yes, it should be quite easy to make it scalable for any number of inputs. Again, I would build the final data structure right in the first loop.

0 Kudos
Message 7 of 7
(2,329 Views)