LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array to 1D

Hey guys, it's me again...

 

I'm close to finish my program, but I still need some help.

 

This time, I collect data in the inner for loop, decode it and put them in a nice array and save it to a file.

I added a second loop to collect some more of data to get a bigger scale on the XY-Graph.

 

The problem is now to get the data out of the loop to the graph.

I'm using a auto index tunnel. The result is an 2D array that contains 10 1D arrays containing the clusters...

 

Now I want to reshape this 2D array back to the origin shape to display it on the graph.

 

I'm not sure how to do this... I can index the 1D arrays out, but how to put them back together?!

 

Thanks!

0 Kudos
Message 1 of 14
(4,150 Views)

Not sure if I get your question but I think an indexing tunnel would resolve your problem. Right click on the tunnel >>> tunnel mode >>> concetanating.

 

Message 2 of 14
(4,131 Views)

Why don't you make the inner loop run longer?

Message 3 of 14
(4,128 Views)

Hallo Steffen,

 

in an older LabVIEW version you would reshape your 2D array of 10×6 clusters to an 1D array of 60 clusters…

 

You didn't get the point on using shift registers in favor of local variables so far, don't you?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 14
(4,126 Views)

What version of LabVIEW are you using?

 

Your problem is that you need to build the clusters OUTSIDE BOTH loops.  You need to build the arrays inside of the outter loop.  If you have 2012 or later, you can configure the ouput tunnels to be "concatinating".  Use that for the outer loop to build your arrays.  Once the outter loop is done, build up your clusters, build the array, and write to your graph.


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
Message 5 of 14
(4,112 Views)

First thanks for your answers!

 

I'm using labview 2014, but the german version.

 

So, I didn't find "concentrating", but it might be "verknüpfen" in german.

 

 

@ nyc the value of the inner loop is fixed

 

@ I need to give a preconfigured value to the variables. I couldn't get this working, when I'm simply shift the values.

 

@ I tried that before and build the clusters outside. It didn't work, but I will try it again. Maybe there was another mistake

0 Kudos
Message 6 of 14
(3,982 Views)

Thanks for your answers!

 

I want to collect the data in the outer loop the same way I do it with the inner loop.

 

Thats why a concetanating loop doesn't work.

I think it will put out the actual value every time it loops.

 

Index tunnel gives me what I want, but I will get an 2D array.

 

 @ I  will try to replace the variables with shift registers...

 

@ nyc the inner loop size is fixed

0 Kudos
Message 7 of 14
(4,062 Views)

I still have no luck after some hours of trying.

Maybe the solution is simple xD

 

I try to explain the problem again:

 

The loop will deliver a 2D array that should look like this:

 

[1,2,3,4,5,6][1,2,3,4,5,6][1,2,3,4,5,6]...[1,2,3,4,5,6]The numbers 1...6 are the channels (clusters of XY-values) and I got 10 of them.Length is shown as [10,6].I like to resharp it suitable for the XY-Graph.

 

I think I can do it as the attatched file shows, but it doesnt work...

 

 

0 Kudos
Message 8 of 14
(4,036 Views)

Hi Steffen,

 

the German LabVIEWForum is operational again, so we could discuss this in German again…

 

You surely want your data

[1,2,3,4,5,6][1,2,3,4,5,6][1,2,3,4,5,6]...[1,2,3,4,5,6]

converted to

[1,1,1,…][2,2,2,…] … [6,6,6,…]

 

Just reshaping your array will produce a graph with 60 plots while you want a graph with 6 plots…

 

As suggested before you should build up the arrays inside the inner FOR loop instead of reordering cluster arrays later on.

Attach a VI (LV2011 preferred) instead of images as we can't debug them (so far)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 14
(4,025 Views)

xD to 1D array.png

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 10 of 14
(4,023 Views)