LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to concatenate arrays generated in a while cycle

Highlighted
Hi!

I'm very inexperienced with labview, and i just want to ask a very simple
thing.

I'm making a sub-vi to read from a spreadsheet file into a array, but i´m
having some bad experiences to concatenate the rows from the file, into a
unique array.

This file contains several records about my city weather that i want to see
separately in a waveform graph.

Can anyone help me?
0 Kudos
Message 1 of 2
(1,020 Views)
Luis,

I'm assuming you are reading each row in a while loop, reading each row one
at a time. If you have the reading each row part figured out the rest should
be relatively simple. You may want to look into reading the entire file versus
one row at a time for performance.

One thing is, do you have multiple data points per row, for example temperature,
humidity ...) If that is the case you may be placing your data into a 2D
array or writing each data item into a seperate array. If all your data types
per record are the same you should be able to use the "Spreadsheet String
to Array" vi ... in this one you basically read the file and output an array
with the specified data type. You should then be able to pull our rows or
columns as needed to chart different data points using the Array functions
in LabVIEW. If you have a 2D array you should be able to use the standard
VI used to select an element, you can expand the VI to add another terminal
... the default for a 1D array just has one input for the index, for a 2D
array you can expand that to have two inputs (one for column and one for
row). In LabVIEW 6i, after you wire your array you should see the vi expand
automatically.

Once you've done that you can "disable" one of the terminals, this will result
in either the entire row (specified by the terminal that is still enabled)
or an entire column being returned. Basically if you specify both the row
and column you get one specific element, if you want to get an entire row
or column (a 1D array) out then you can disable one of the terminals and
use the other to specify the row or column. You should then be able to wire
in these arrays into your graphs.

If you don't want to or can't read the entire file in one go you can use
the while loop to read each row at a time. You'll then need to concatenate
each array, you can use the "Build Array" vis to do this. In order to preserve
the array as you build it in each iteration you'll need to use "Shift Registers"
(the LabVIEW manual should have info on this and you should be able to look
at this example for an idea on how they work: http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&2BF95DD758FA72828625687000600884&cat=2E4161187E3DEB30862568660020BCC8).
With shift registers you can keep passing data between loop iterations.

From your message I'm not sure which part you're exactly having difficulty
with, the reading, parcing, or display. Hope this get you along your way.
Kamran
0 Kudos
Message 2 of 2
(1,020 Views)