LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write array to file

    Hi,
i am trying to write an array coming out of a for loop into a file. If i plot the array in the Front panel everything works, but if i write it to a text file some aditional characters (empty space and this rectangle) appear.
The file should look like the text file but without spaces before first number of row and rectangle.
Attached are .txt and screenshot of blockdiagramm
Thanks for any help
Philipp
Download All
0 Kudos
Message 1 of 3
(2,605 Views)
You're doing a binary write of an "array of strings". It seems you want to write a plain string.
 
Quickest solution would be to insert a size=1 "concatenate strings" in the array after the loop and write the resulting plain string.
 
(There are probably better solutions that require a bit more coding, though. How much data do you typically write to the file?)
 
There are some really odd code fragments that make little sense (e.g. autoindexing the file name followed by an index array).
It is difficult to see the reasoning without seeing the rest of the code. Can you atttach your program?


Message Edited by altenbach on 05-24-2008 01:39 PM
0 Kudos
Message 2 of 3
(2,598 Views)
First of all: Thanks.

Your solution did exactely what i want, and i am fine with using a non-elegant version, if it works.
About that autoindexing + indexing the path:
I know this is stupid, and i changed it to not  autoindexing. But these things happen, when you try to quickly expand an already existing vi and want to automatize with for loops instead of doing the same things over and over.
I am attaching the whole vi. it first was just the analysis, basically the inner loop, where i wanted to be able to vary the number and size of the parts of the waveform that go into the PSD to see how analysis time and numbers of averages effects the spectrum.
In the next step i created a vi that writes a string of two variables in a file, and then i wanted to do this for all files in a directory.
i am totally aware of the fact, that there are several dirty solutions. But i guess you are used to seeing these things, that could be done much more elegantely and efficiently, but if you try to get a quick solution that works for you and you learned Labview by trial and error, this is the way your vi´s look like.
By the way, what would you suggest to learn "clean" labVIEW programming ?

thanks again,

Philipp
0 Kudos
Message 3 of 3
(2,584 Views)