cancel
Showing results for 
Search instead for 
Did you mean: 

Collecting data - how to format into array?

questiona3
Member

Collecting data - how to format into array?

Message contains an attachment

I'm collecting data from an instrument, formatting it as a string, and throwing it into a text file. As of now, it records data, goes to the next line, and records the next data point, etc. But what if I want to have it so that it starts a new line every six data points? For example" [datapoint1 datapoint2 ...... datapoint6 -> new line -> datapoint7 datapoint8....]

 

I was thinking maybe I could fill a 1D array and then resize it to something like [m/6 by 6], so that I would have 6 columns. I could also initialize a something by 6 array and have Labview fill in each entry in order. Unfortunately, I'm stuck, and I need some advice on what to do. I must not be understanding something about how arrays work in labview. I have attached my work so far. Any help would be appreciated!

 

 

Message Edited by questiona3 on 12-31-2009 11:38 AM
13 REPLIES 13
Dennis_Knutson
Knight of NI

Re: Collecting data - how to format into array?

Could you clean up your block diagram and repost. You have wires going in every direction, hidden under other wires, etc., making it very difficult to read.
altenbach
Knight of NI

Re: Collecting data - how to format into array?

Obviously, you would need to build your array in a shift register.

 

Currently, you are taking a single string with each iteration and convert it into an array with exactly one element. No amount of reshaping will get your history data. Smiley Wink

 

I no longer have access to LabVIEW 7.1, so see how far you get and ask again when you get stuck. Smiley Wink

altenbach
Knight of NI

Re: Collecting data - how to format into array?

Message contains an image Message contains an attachment

OK, here's a quick draft, see if it makes sense.

 

Basically, you built the array in a feedback node and whenever you have six elements, you clear the feedback node and write the line with the six new elements to the file.

 

This example is very primitive and should be polished. Still it should get you some ideas. Smiley Wink

 

Message Edited by altenbach on 12-31-2009 11:37 AM
questiona3
Member

Re: Collecting data - how to format into array?

Thank you very much for your help. I won't have a chance to work on it until next week, but I will let you know how it goes!
Knight of NI

Re: Collecting data - how to format into array?


altenbach wrote: 

Basically, you built the array in a feedback node ...


To poster: In LabVIEW 7 there is no feedback node, so you'll just have to make do with stone tools such as the quaint shift register. Smiley Wink

 

Shift registers are explained in the LabVIEW manual.

 

altenbach
Knight of NI

Re: Collecting data - how to format into array?


smercurio_fc wrote:

altenbach wrote:  To poster: In LabVIEW 7 there is no feedback node, so you'll just have to make do with stone tools such as the quaint shift register. Smiley Wink

Actually, the VI in the first post is LabVIEW 7.1 and does actually contain a feedback node. It is just not used correctly. Smiley Wink

Knight of NI

Re: Collecting data - how to format into array?


altenbach wrote:

smercurio_fc wrote:

altenbach wrote:  To poster: In LabVIEW 7 there is no feedback node, so you'll just have to make do with stone tools such as the quaint shift register. Smiley Wink

Actually, the VI in the first post is LabVIEW 7.1 and does actually contain a feedback node. It is just not used correctly. Smiley Wink


Sorry - didn't open the VI. Just read LabVIEW 7 for some reason. 

TCPlomp
Trusted Enthusiast

Re: Collecting data - how to format into array?

LabVIEW 7 has feedback nodes they are not as efficient as shift registers, or feedback nodes in later versions.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Knight of NI

Re: Collecting data - how to format into array?


TCPlomp wrote:

LabVIEW 7 has feedback nodes they are not as efficient as shift registers, or feedback nodes in later versions.

 

Ton


Hmmm.. for some reason I thought LabVIEW 7 did not have feedback nodes, but LabVIEW 7.1 did. Not sure why I thought that.