04-29-2010 08:38 AM
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
Solved! Go to Solution.
04-29-2010 09:33 AM
Here's a snippet of some code that should help you!
This should work for data composed like your original data. However I could not test it because I miss a valid dataset.
Ton
04-29-2010 10:21 AM
Thank you I'll try immediatly,
here is also a data example (TestA.lvm)
04-29-2010 11:29 AM
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
04-29-2010 12:05 PM
04-29-2010 12:36 PM
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
04-29-2010 12:53 PM
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
04-29-2010 01:02 PM
That's nice you got it solved!
It's too bad you don't want to trade sides on the programming keys.
Ton