LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inserting columns of data into a 2d array at specific locations

Hello
I have a probably simple procedure that I need help with.
I would like to insert columns into a 2D array at specifiec locations, based on the columns that are already in the array.
For example I have an array A with 6 columns, with the first row being the headers/labels, so that I have column 1, 2, 5, 6, 9, 10. In the rows there is data.
So I want to insert columns 3, 4, 7, 8, and their corresponsing headers/labels and the data rows just filled with zeros so that I end up with array B that will have 10 columns with 1st row headers/labels numbered from 1 to 10 and the data in 3, 4, 7, 8, will be padded with zeros.
 
Could someone help? I am attaching a front view panel of what I want to do, in case I have not explained it clearly enough.
 
I will appreciate help with this. Thank you.
 
 
0 Kudos
Message 1 of 9
(3,805 Views)
Use insert array function as shown in the pic
0 Kudos
Message 2 of 9
(3,799 Views)
Hi Thanks for the response however that won't do.
The arrays to insert will depend on what columns are missing from the original array A.
So in my previous example, columns 3, 4, 7, 8 need to be inserted to produce array B.
However, it could be any other number from 1 to 10, depending on what the confguration of array A is.
So it could be that Array A has numbers 2, 4, 6, 8, 9, then in this case I would need to insert columns 1, 3, 5, 7, and 10.
 
Please note that this is just an example. My actual data has 2500 columns (1-2500) with 600 rows, and it could be missing about 200-400 columns that need to be inserted into it.
 
Could you still help with this? or how do I re-post the question?
Thanks.
 
 
0 Kudos
Message 3 of 9
(3,793 Views)
No need to repost the question.
 
Others will read this thread and suggest if they have better solutionsSmiley Happy
 
What you could do would be
To do this ethire process of inseting inside a while loop and a shift register.
 
look at pic
 
If you want to insert a new column, just specify the column index , enter column elements and click on boolean.
 
Note: This is just to give you a hint on how to go about.You will have to think of a logic for how you can programatically insert those missing arrays
0 Kudos
Message 4 of 9
(3,789 Views)
Hi
thanks again that is a good suugestion. however I must not be explaining myself clearly enough...let me try again:
 
1. I have many very large files to process so doing this manually would take me a very long time. And if this is what I need to do then, there is no advantage of using Labview as I can do this manually in XCEL...
 
2. from the example file I posted: I would like Labview to identify which columns are missing based on the header information. Remember that these headers are numbers from 1-10 in sequential order, so Labview would identify columns 3, 4, 7, 8 to be missing from array A and then I would like Labview to insert these 'missing' columns  (3, 4, 7, 😎 in their respective locations (automatically) so that I end up with a file that looks like array B.
 
I hope that this is clear. It is diffucult explaining what you want to do in an email.
 
Thank you for you help
 
 
 
0 Kudos
Message 5 of 9
(3,785 Views)
Just initialize an array of the final size containing the header row.
 
Now go through the input array and replace columns according to their index. Leaving the rest untouched.
 
This allocated the final size array in one swoop, which is much more efficient compared to growing the array one column at a time. and searching for missing indices.
 
 
 

Message Edited by altenbach on 08-31-2006 09:43 PM

Download All
Message 6 of 9
(3,778 Views)
.thank you guys.
0 Kudos
Message 7 of 9
(3,771 Views)

From where do you plan to load/insert this missing columns (1D arrays)??

will it be stored in a .xls file??

0 Kudos
Message 8 of 9
(3,762 Views)
from a text file
0 Kudos
Message 9 of 9
(3,755 Views)