LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continual column insert to arrays or text file, please help.

I am about 3 seconds from swearing off LabVIEW forever. I have been trying for the last 10 days to complete something very
simple but to no solution even from the help desk. I am trying to continually add columns of data to an array without overwriting
the previous entry, nothing has work. In addtion I am also trying to write the contents of a number of one column and 100,000
row arrays to a text file without creating an enormous one column file. CAN ANYONE HELP??? I would greatly apprecitate it.
0 Kudos
Message 1 of 7
(3,885 Views)

If you explained exactly what you've tried and how it doesn't work, you would get a more specif answer but shown below is a simple method to append columns to an existing array. It uses some basic elements in LabVIEW such as the Build Array function and a shift register. Use the Attachment field below the message body to attach your code.



Message Edited by Dennis Knutson on 03-13-2008 05:29 PM
0 Kudos
Message 2 of 7
(3,880 Views)

Dennis,

thanks for the response. So, here is what I am trying to do, I have a number of very large

.csv files, that contain 75 variable names as column headers and 170,000 double data

type values for each variable.Overall, I am trying to create a customized file from that .csv

file that has only a user's selected variables and its values.  Now, I am able to get whatever

variable I want and its values. The problem I am having is that when trying to store that data

to an array so that I can write it to a file the current overwrites the existing. I have tried writing

directly to the file with write to text file, write to spreadsheet, and others nothing works. I have

tried feeding the current back throught the loop with the feedback node and shift register. I have

tried to initialize an array and replace contents, I get the same result. I will add a couple of code

iterations to this post I hope someone can help me out. I thought it would be more intuitive to

to accomplish, I never thought it would this difficult. Thanks

0 Kudos
Message 3 of 7
(3,861 Views)

Dennis,

Would like to add the lastest rev for you and others to look at.

Thanks again.

0 Kudos
Message 4 of 7
(3,859 Views)

I'm sure Dennis will have a lot more comments, but this is the first thing I saw.

In this structure (and the way you have it set up, you could merge the sequence frames and merge the case structures) you are creating an empty, huge array.  Then you insert something into the first column. show that in the output array indicator.  Then you delete the first column and feed that to the shift register.  In the end, you are left with what you started, a large empty array that just happens to flicker a column on an indicator.

In general, I would say there are 3 ways to work with arrays.

1.  Initialize an empty array and replace elements as needed.  (Most memory efficient.  But you will have to worry about if you need to expand your array or contract it in the event you can't anticipate how large the array will need to be.)

2.  Start with nothing and build the array piece by piece.   (Not as memory efficient, but is commonly used in cases where memory efficiency is not critical.)

3.  Start with some kind of array and insert and delete from it.    (Not used very often.  This would be similar to have an existing database and you need to manipulate the data such as adding or subtracting rows.)

You've basically managed to mix and match from all 3 of these scenarios in your code.Smiley Wink

0 Kudos
Message 5 of 7
(3,851 Views)

Raven,

Thanks for the help. I noticed the first problem you mentioned seconds before

I read your email. So, I am glad to hear that I have made a correct change. Is

there anything-else you see that maybe causing trouble. I have been dealing

with this thing so long I could use a fresh pair of eyes, I missing obvious stuff.

Would initializing an empty array at the beginning resolve the issue or is there

more ahead. Thanks, man.

0 Kudos
Message 6 of 7
(3,847 Views)
Hi vehnasa,

so much more causing trouble... Attachment shows a (somewhat) cleaned up version.
I didn't change this array handling a lot as it wasn't clear what you want to achieve... I only moved it out of the loop as it was only called in the last iteration.

Remember: In LV the wire is the variable of text-programming languages! No need for locals or (even worse) "value" property nodes!



Message Edited by GerdW on 03-14-2008 04:22 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,835 Views)