Labview filling an array with data - labview

I have code which generates an amount of data continuously and I'd like to store generated data in a 1-dimensional array.
How do I do this in LabVIEW?

Are you using the array to transfer data from your data acquisition to another location? If you know how many elements are in the array, you should first initialize the array to that size. Then you can place data in the array by using "Replace Array Subset". This way you're not continuously allocating memory. This also assumes that you're moving that data out of the array prior to the next instrument read.

In this case it is better to use while loop (if you know the exact number of data you can use For Loop as well, giving an N terminal defined number of iterations). Simply connect your generated data wire to the border of the while loop, right click it and choose Tunnel Mode:Indexing and you will get and array.

Related

How to add button for each row in table?

Labview,
i would like to add button for each row in table and this button depends on number of rows of data in the table,Button will add programatically in each row.
Reference Image: Cross button
When do you say "Table", Are you referring to "Multi-Column ListBox" or "Table Control" or Individual 1D arrays that are arranged like a Table? There are many ways you can do this!
An array of Clusters as Dave_St suggested.
Using a Table control & Boolean Array.
Using a Table control & Array of Picture Ring.
Using individual 1D Arrays Arranged like a Table.
I'd recommend the first method. Since it makes data handling pretty easy!
But If you're going to go with any other method! You can make your boolean array background as white/transparent and place on top of a Table Column!
Example:
In the above image, I used a Table Control and an array of Picture ring. But you need to synchronize both your array's scrolling positions! Only then the user shall be able to see the correct status for the row.
It seems like you're trying to imitate a webpage form! If you want to dynamically add controls/indicators to your VI check out VI Scripting! But I'm not sure whether VI Scripting will satisfy your requirement.
There are a couple of other ways to get this behavior. However, the array of clusters is probably the easiest. Two other ways to do it are:
Use the glyph (symbol) functionality of a table or multicolumn listbox
Create a data grid or use the DataGrid QControl.
P.S. You currently cannot programmatically add controls/indicators during run time. So VI Scripting won't help you there.

How i can manage iterations in WTX reading a copybook

I have a copybook with an array of 30 products that I need to map to a XML message and a field that content the number of iterations that have information, but if there are not the 50 products some iteration come empty.
Actually I have a WTX map that map the array, but the map iterate over all the array even some iterations dont have information.
How can I map/validate only the iteration with information? Or how can i use the field en the copy book that indicate the number of iterations that have information to only map this ocurrences without go through all the array?
If you have a copybook with a fixed number of elements, all the elements are always there. That's how copybooks work - a fixed record size makes it easy to find a record's position in a file.
If you don't want to map all of them, you will have to add an IF testing for some condition telling you that the slot is not empty. Like whether part_number (or something) is greater than zero (or not blank, depending on your data types).

Labview getting data out of while loop after each iteration

I want the data out of while or for loops in Stacked Sequence Structure after each iteration..
I want the data out of loops even if it is not stopped that is after each iteration.. to see the plot of data at each iteration and continue to the next loop in the same plot
somebody please help me ..
I want to send and get data from a device, the data will be plot each time.
thanks..
Write to a functional global variable inside your data acquisition loop, then read the FGV & plot it in a loop parallel to your sequence structure.
You can also use a queue to pass data between two different loops:
Notice the different waiting times on each, in the example it updates around five new points each time to graph.
It should be possible to just drag the picture into an open vi to get the code.

Sort multiple column in notepad using vb.net

I am doing a project that requires me to transfer data from one notepad to another notepad (saved using excel tab delimited form).
I have successfully done that, the only that left is I need to sort those data after transferring it.
For your information, I am transferring 5 column from the first notepad to the second notepad. I saved those information in five arrays.
How am I supposed to sort them after pasting?
I tried using vb.net sort function but that only will sort one array while the rest of the arrays wont follow.
I tried lines.sort also but the result is not satisfying, any other idea to sort those data like what we normally do manually in excel?
Any help will be very much appreciated.
One solution would be to create an object with 5 values in it. Then you would create an list of those objects (that way the values are all linked).
Then you would just do:
OBJECT.Sort(Function(x, y) x.valueToSortBy.CompareTo(y.valueToSortBy))
This would give you a list of your objects sorted by the value you wanted.

What is the best way to store and access static table data?

A real beginner here,
I am looking to have a table of static data with about 300 cells in it. (There will be 12 distinct tables in all)
The user would input two values, the first would indicate the row, and the second would point to the cell within that row, and I want my app to be able to read back the column heading for that row.
What is the best way to have this data stored in my app? Currently the data is in a spreadsheet.
The data looks like:
Index 0,Index 1,Index 2,Index 3 ,Index 4,Index 5,Index 6,Index 7,Index 8,Index 9
10,156,326,614,1261,1890,3639,5800,10253,20914
20,107,224,422,867,1299,2501,3986,7047,14374 ...etc.
Where the number at index zero is the name of the row (entered by user) and the numbers after that are the values also entered by the user.
I want the code to take the two numbers (row and value) and then return a string based on the column heading (shown here as index 0 - 9)
the last tricky bit is if the user enters a value that is in between the values give I want it to use the next highest value from the data. E.g. if in row "10" the user inputs 700 I want the code to return the index heading for 1261.
Does that make sense?
Possibilities are endless...
In code as a static 2D array
XML
JSON
Tab Delimited Text File
Comma Delimited Text File
PList
etc.
All depends on your needs and wants.
On the CONs for each:
Static 2D array may consume some memory every time the app runs...
A file will involve some disk IO or processing requirements to read the values out of the file stored in the Bundle.
On the PROs for each:
Data from the static array would be FAST...
Updating data in a file could be done on-the-fly over the web.
You could write a simple routine to dump your spreadsheet into any of the above listed options, so I don't think that's a real serious consideration. It's mostly about what works best for you in terms of size of data and updatability/maintainability.