08-30-2010 09:43 AM
@AndreaD wrote:
Sorry, I'm not sure if I can post my code online due to policies of the agency I'm working with.
Thanks,
Andrea
If you could make a quick skeleton VI that shows us what you're trying to do without giving away any state secrets that would help us help you.
08-30-2010 09:46 AM
Also, as a previous post asks, is this an actual Excel spreadsheet, which uses a proprietary format of data, or a text file that uses comma separated values, or tab delimiters? There is a difference, which requires different tools. But as mentioned you can load an front panel display programmatically. Using a cluster may not be the way to go, unless your data format won't change.
08-30-2010 10:13 AM
Essentially what I'm trying to do is to create a cluster, which will read and pass along a large amount of data. The data format can be an excel file, a spreadsheet, text file, or whatever means to read the amount of data. I have the flexibility of copy-pasting the data, or I can just upload it, whichever way is easiest.
Currently, I have an array in the cluster, which I would have to manually enter the data in, and is not a feasible option for a large amount of data.
Sorry for the confusion this has caused ... I've included a brief sketch of what I mean. It's easier than how I worded this in the previous two posts 😛
Thanks,
Andrea
08-30-2010 10:27 AM
That picture conveys almost nothing in terms of information. All I see is a box with another box and an arrow. No information on datatypes. Unless you provide a better explanation, I don't see why you can't just use a 2D array at this point.
08-30-2010 10:30 AM
Currently, I do have a 2D array with 8 bit unsigned integer. I don't think I can copy/paste a large amount of data into a 2D array.
08-30-2010 10:41 AM
@AndreaD wrote:
Currently, I do have a 2D array with 8 bit unsigned integer.
Is that what your data actually is?
I don't think I can copy/paste a large amount of data into a 2D array.
Why not? What problem are you actually running into when you try it? Where are you copying the data from?
If you're trying to populate some front panel control and the source of data can vary then you need to better explain whether this is an action that you're trying to perform while you are editing a VI or when the VI is running. If it's when it's running, then a better approach is to provide a file path control with a button to read the file. If you want to support multiple file formats then you would need to determine the file type (such as by looking at the extension), and call the VI to read the file and return the data which you can then write to your front panel control. If it's an Excel file then you need to use ActiveX. There have been tons of examples posted on read/writing Excel, so just search and you'll find them. There's also the Excel thread for additional links. If it's a text file then you can simply use Read From Spreadsheet File if you have a delimited text file. Alternatively, you could limit the files your program can read to simply being delimited text files. This makes your life easier, but it would require someone else to create the appropriate file type (such as saving from Excel to a text file).
08-30-2010 10:45 AM
You need to be a little more specific as to how you want to import the data. The reason that I say that is because there are a number of different ways to do this. If it is a text file or a tab delimted file then you can use pure G functions but if it is in excel then it gets a little trickier and not as easy to do since you would have to have a special toolkit or you would have to learn how to use Active X. To write a program to use all of these could be done but it would make it a lot easier on you if you would define the data structure first (ie Excel spreadsheet or tab delimited text file, etc...) and then import it in to LV
08-30-2010 10:48 AM
OK, now I see. This is a very common thing in LV. You already have a data structure (a cluster) that has a 2-D array of raw data and some other things (process variables or whatever) that you are also storing in the cluster to keep things tidy.
Here is a simple example:
08-30-2010 11:04 AM
Ugh, I didn't know there was a time limit on editing your posts! What a pain that it doesn't even give you a chance to save what you've already written.
Anyway, it's true there's extra crap in an actual EXCEL (.XLS from MicroSoft) file. Just save it as a tab delimited text file first. Then you can read it with the simple LV tools. Otherwise you'll need ActiveX or the Report Generation Toolkit, which unfortunately kind of sucks.
08-31-2010 10:16 AM
Apparently after hearing the same answer for the third time we've come to an accepted solution of just dealing with a text file... Kudos to all who repeated the same thing...