LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array reorganisation

Solved!
Go to solution

I have an issue about how to reorganise an array. I have also joined an example proposed by NI but it holds only for 4 spectrums. I am also joining a simple example of array to reorganise (testa.lmv)

 

Summary:

Many Voltage-Current spectrums are stacked on top of each other in 2 columns (like in the simple example "testA.lmv" where 4 spectrums with 11 points each are stacked on each other).

I need to transform this array in "N (in the example N=4) times 2 columns of Np (in the example 11) points each".

The number of spectrums and the number of points for each spectrum are known but vary from one experiment to the other.

Within one experiment the number of points Np per spectrum is the same for all spectrums stacked in 2 columns.

 

For 4 spectrums it is easy to use the "sub array" tool and to include 4 times the sub-array tool to extract each spectrum.

But; because N is different for each experiment  I will not modify each time the vi and so I have tried to combine the "sub array" tool within a For (or while loop) with N cycles, 1 for each spectrum.

Unfortunatly it does not work

Does anyone has an idea how to deal with such a combination of sub-array and For loop (or while) ? or does it exists a better solution ?

 

Thank you

 

 

0 Kudos
Message 1 of 8
(2,828 Views)
Solution
Accepted by topic author Youki

Here's a snippet of some code that should help you!

 multiplot_BD.png

 

This should work for data composed like your original data. However I could not test it because I miss a valid dataset.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 8
(2,806 Views)

Thank you I'll try immediatly,

here is also a data example (TestA.lvm)

0 Kudos
Message 3 of 8
(2,786 Views)

Thank you Ton,

 

The solution works well as long as I have no For loop (see first vi file included)

Once I introduce the For loop the link brokes (see second vi file included)

I had already tried many times similar solution but I am always facing this issue that the links broke once I put the For loop

What did I wrong here

 

Thank you

0 Kudos
Message 4 of 8
(2,768 Views)
Disable auto indexing on your tunnel going into the For Loop.
0 Kudos
Message 5 of 8
(2,756 Views)

Raven's fan is right, but since you have LabVIEW 2009, you can drag and drop the code I showed into LabVIEW.

Have a look here to see how to use snippets.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 8
(2,745 Views)

Thank you to both of ,

 

I have solved my problem now. The auto indexing staff was the issue.

I cannot transfer a snnipet so easily because the computer with labview 2009 is not allowed to be online as it is a lab computer

 

I made my first own VI last week but I have a lot of experience in text programmation

No intention to go beyong what I need for my equipments

 

Youki

 

0 Kudos
Message 7 of 8
(2,740 Views)

That's nice you got it solved!

It's too bad you don't want to trade sides on the programming keys.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 8
(2,736 Views)