09-10-2012 02:00 PM
My vi right now reads an column of numbers as a 1-D array, but I need to input the numbers manually, and for what I'm trying to do, there could be anywhere between 100 to 500 numbers to input. I want the vi to be able to read the excel file and use that column of numbers for the rest, which the data type is long (32-bit integer).
I have an example vi that is able to get excel values, but the output data type is double (64-bit real).
I need to either be able to convert double(64-bit real) data to long (32-bit integer), or find another way to get the values from the excel file.
09-10-2012 02:09 PM
Can you share your example? It might be something as simple as telling it to output an I32. Or you can simply use the I32 conversion bullet (look in the numeric->conversion palette).
09-11-2012 09:37 AM
Attached is the example. If that isn't enough, I can provide the vi with which I am trying to have it work with.
I have looked through a conversion palettes, but it's very possible I skipped over the proper bullet.
09-11-2012 09:57 AM
09-11-2012 10:14 AM
I asked for the example to see if you were actually reading from Excel or reading a "spreadsheet" file.
As was said, if you are using a CSV file, then you can read it directly in LabVIEW. No need to interface with Excel. If an actual xls(x) file, then you need to interface with Excel.
You can use the To Long Integer bullet to convert your array.
09-11-2012 10:19 AM
09-12-2012 08:28 AM
I read that I could export the excell sheet to a csv file just by doing a Save As and saving it as a .csv file. I did this, used the "Read from spreadsheet file.vi" and directed the file path to this new csv file. When I try to run the vi, I get an error message saying it can't find file. Possible problems are that the file no longer exists or the file path was not written properly. Both of those are not the case so I'm not sure what the problem is.
Is there maybe something else I need to do maybe with creating the csv file, directing the file path, or maybe am I not properly using the "read from spreadsheet file.vi"?
09-12-2012 08:30 AM
09-12-2012 08:41 AM
Just to expand on what GerdW is saying. There are many programs that hold exclusive access to a file. So if a file is opened in Excel, the LabVIEW cannot access the file.
What is the exact error code? Different error codes will point to different issues.
Make sure the csv file is exactly where you think it is and LabVIEW is pointing to the right place. (I'm just going through stupid things I have done)
09-12-2012 08:43 AM
I wish it were that simple. I did try that, and I still got the same error message. Do you know of any other applications that can create csv files?