From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

columns for spreadsheet with arrays

I have a data acquisition program that saves arrays as .txt files for
further analysis. I'm writing a program and having problems getting the
data in 4 columns like I want.
My data consists of 4 files, 10 data points obtained per iteration.
Each iteration is saved as a new column. The files have a lot more that
2 columns in reality. For example
A B C D
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
I would like som
e help in getting my 4 files put into one file,
consisting of 4 columns only. I would like my data to look as follows.\
A B C D
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
1 3 5 7
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
2 4 6 8
and so on. Essentially I want to take each iteration of data and place
underneath the previous iterations data in one column. I have tried
many different methods with for loops and various array tools and can
not get it right. Any ideas and help would be greatly appreciated!

Heather


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 3
(2,400 Views)
hmmille@my-deja.com wrote in message <8lnlrs$8o4$1@nnrp1.deja.com>...
>I have a data acquisition program that saves arrays as .txt files for
>further analysis. I'm writing a program and having problems getting the
>data in 4 columns like I want.
> My data consists of 4 files, 10 data points obtained per iteration.
>Each iteration is saved as a new column. The files have a lot more that
>2 columns in reality.

How about...

If you open your text files into strings, then 'match pattern' within a
while loop or otherwise search the strings to replace any 'newline'
characters with Tabs. If you then convert the string to an array, you should
have one long row. You can then transpose this to one long column with one
of the array tools - 'reshape array' maybe - I can't remember
. If you do
this for all 4 files, then use 'build array' to stick them together, you
should get what you want.

Paul
0 Kudos
Message 2 of 3
(2,400 Views)
> How about...
>
> If you open your text files into strings, then 'match pattern' within
a
> while loop or otherwise search the strings to replace any 'newline'
> characters with Tabs. If you then convert the string to an array, you
should
> have one long row. You can then transpose this to one long column with
one
> of the array tools - 'reshape array' maybe - I can't remember. If you
do
> this for all 4 files, then use 'build array' to stick them together,
you
> should get what you want.
>
> Paul
>
>
Paul,
Thanks for your help. I used the match pattern to find and replace
the new line characters with tabs. The four columns have 10 data
points, then two zero's separating them from the next 10 points. I used
the same idea to get rid of the retur
n characters and replace them with
tabs, which got rid of one row of zeros. I've tried the same idea using
backspace, form feed, space characters, etc, and I still have one row of
zeros separating my data points. Do you have any idea what this
character could be? I tried all of the characters in the manuals and
none will get rid of this problem. Again, thank you very much for your
push in the right direction!

Heather


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 3 of 3
(2,397 Views)