07-02-2017 05:22 AM
Is there a quick and better way to transform the data from a .csv file from the following format
a,V,b,c,d,e,f
1,100,1,7,13,19,25
1,200,2,8,14,20,26
1,300,3,9,15,21,27
2,100,4,10,16,22,28
2,200,5,11,17,23,29
2,300,6,12,18,24,30
into the following one:
b1,b2,c1,c2,d1,d2,e1,e2,f1,f2
1,4,7,10,13,16,19,22,25,28
2,5,8,11,14,17,20,23,26,29
3,6,9,12,15,18,21,24,27,30
a represents a bias point
V represents applied voltage to DUT
b,c,d,e,f are current readings.
The objective is to be able to plot all this .csv data into an XY graph.
At the moment I'm using the code attached but I think it is messy (and clearly showing I'm a newbie in Labview), hopefully there is a better way to do this.
Please note that:
1) The code should work independently from the number of columns in the .csv file.
2) The first column (column a) represents a bias point, therefore it can vary in length but it will always be a sequence of repeated numbers (aaabbbcccddd, or aaaabbbbccccdddd or similar).
Solved! Go to Solution.
07-02-2017 07:17 AM - edited 07-02-2017 07:18 AM
You really need to learn to use Index Array. You can use that instead of Array To Cluster followed by Unbundle By Name. And it is expandable. You can also use Index Array in order to read a single row or column (wire up just the needed index).
Another useful function is the Delete From Array. You can use that to remove a row or column from your data. It can even be used to separate a column/row from the rest of your data.
And finally, you can do some cool things with Reshape Array.
Here is my code that does the equivalent of yours. At least it gave me the same outputs as yours. I just removed your file read and made controls for trying it out.
