LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Program to sort the outputs

How to make a Labview program so that, the successive outputs should be sorted in two separate columns. For example, if I have a program named "Read", for each run of "Read", it will give an output. I wan to run it, say, 200 times. I want to put the successive outputs in two columns P and Q. The output of the first run in column P, 2nd run in column Q, 3rd again in coumn P (second row), 4th in colum Q (second row), 5th in column P(third row), 6th in column Q(third row) so and so...... How can I make this loop?

 

Better if I can use a for loop! but confusing how to separate into two columns...

I am new in Labview. It would be great if someone can give me a sample program to illustrate this. Thanks a lot...

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

I would use a FOR loop with 2 calls of your subVI in it.  You can then combine the results into an array (Build Array) and use Autoindexing to come out with a 2D array.


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 7
(2,857 Views)

You can also run your program in a loop and index the output into a 1D array and then use Decimate 1D Array.vi (in the Array Palette) to split it into two arrays that contain alternating values from the original array.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 3 of 7
(2,838 Views)

@NIquist wrote:

You can also run your program in a loop and index the output into a 1D array and then...


That's a good idea.  If the OP wants a 2D array, I would use the Reshape Array function.  Then you can turn it into however many columns you want.  A lot more extensible than my original idea.


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 4 of 7
(2,828 Views)

decimate, build (do not concat) and transpose

 

Those functions on the array manipulation palatte can be fairly helpful.  A quick look through the help is in order.

!0.png

 

Spoiler
Now wait for altenbach to do this on a postage stamp using CDB data

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 7
(2,823 Views)

Or, if you need to scale it up to an arbitrary number of columns the Signal operations palatte has a real gem.

!0.png


"Should be" isn't "Is" -Jay
Message 6 of 7
(2,813 Views)

@JÞB wrote:

Or, if you need to scale it up to an arbitrary number of columns the Signal operations palatte has a real gem.


Or you could just use Reshape Array...


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