| Author |
Topic  |
|
|
masterd
Australia
Posts |
Posted - 04/23/2006 : 02:46:32 AM
|
Origin Version (Select Help-->About Origin): 7.5pro Operating System: 2000 pro
With our labview software, raw data gets fed to Origin where it gets analysed and then fed back to labview using OAGetWorksheet.vi where results get displayed on the screen and saved as text file.
OAGetWorksheet works fine as long as the all columns are numeric. however, as soon as any one of the columns contain things like labels and/or sample names, (regardless of column type; x,y,z,l) nothing gets imported at all eventhough you can see all the data in the origin worksheet. So, can OAGetWorksheet retreive alpha-numeric colums and if so how? if not, is there any other method?
Thanks a lot,
Darko
|
|
|
Deanna
China
Posts |
Posted - 04/23/2006 : 10:33:03 PM
|
Hi, Darko.
We have tried exporting data from Origin to Labview 7.0 with OAGetWorksheet. It works well as long as the columns do not contain any texts. Even when the columns have labels, it still works.
I wonder if the "labels" in your worksheet are actually cells that contains texts. If so, they will encumber the exporting.
To set labels in Origin 7.5. you can right-click on a column and choose properties from the menu. Then fill the text box under "column label" with the label text.
If you still have problems about the exporting, please email your data and vis to us via email:tech@originlab.com.
Deanna OriginLab GZ Office |
 |
|
|
masterd
Australia
Posts |
Posted - 04/24/2006 : 12:18:11 AM
|
Columns containing text is my problem! first column of the wanted result worksheet contains text (sample names) while other 3 columns are just numeric. each column has column label just as in the pic attached.
when i define c1 terminal on OAGetWorksheet.vi as 0, nothing gets imported. it works fine when c1 is set to 1; ie. skip first column.
Why do text containing columns encumber the exporting when OAGetWorksheet is used? is there any other way of exporting text from origin to labview?
Darko

|
 |
|
|
easwar
USA
1965 Posts |
Posted - 04/24/2006 : 11:10:48 AM
|
Hi Darko,
It should be possible to get "data" from Origin that is mixed text and numeric. The "data" is sent from Origin in Variant form and the variant data can be converted to different formats etc at the client (LabVIEW) end.
If you look at the detailed block diagram of OAGetWorksheet, you will see that one of the components is "Variant to Data" which is used to convert the variant data to double in this case. The data type input for this component has been set to double inside of the OAGetWorksheet VI.
You don't have to use the OAGetWorksheet VI, but instead directly use the Origin GetWorksheet method in your VI, and then you will have the flexibility to change the data type input to "Variant to Data" etc.
I do not know enough LabVIEW programming to help you with specifics of "Variant to Data", but I hope this helps and you can look up LabVIEW help for details.
Again, to emphasize, the sub VIs we ship are mainly for convenience and they are "programmed" in a certain way, and so if they are not suitable for a specific case, they could be copied/modified, or you can directly use the automation methods of Origin by using controls from the COM/ActiveX palette in LabVIEW, which is what is contained inside of the subVIs that we ship.
Just to make sure mixed data and text can be fetched, I tested this with Excel VBA (which I know better than LabVIEW!) and with Excel, one can simply "set value" to a range of cells in a sheet using Variant data from Origin that contains both text and numeric data. In the case of LabVIEW there could be some conversion involved that you need to look up. The sample Excel VBA code is pasted here - the range "MyRange" was a name assigned to a group of cells in sheet1. With this code I could bring in text+numeric data from data1 worksheet to the Excel sheet.
Easwar OriginLab
Private Sub CommandButton1_Click() Dim oApp As Origin.ApplicationSI Set oApp = GetObject("", "Origin.ApplicationSI") oApp.Execute ("doc -mc 1;") Set rng = Range("MyRange") rng.Value = oApp.GetWorksheet("Data1", 0, 0, 16, 1) End Sub
|
 |
|
|
zachary_origin
China
Posts |
Posted - 04/24/2006 : 9:52:01 PM
|
Hi, Darko,
I think you must modify the OAGetWorksheet sub VI and save as another VI.
 As there is a column of text in your worksheet, you can change the type of the variant to data to a two dimensional strings array, that you can get the whole worksheet data to a strings array. Then it is convient to get the subarray and convert the non-text data(the double numeric data) from string to number using "String/Number Conversion" functions in LabVIEW.
Another method is to get the text column and the number column seperately. You can get the text column by setting the type as two dimensional strings array, and get the number columns by setting the type as two dimensional double array, which is same as the original OAGetWorksheet sub VI. Then you get two arrays, one is the text and the other is the number.

I have only tested the first method, but I think it works too. The Block Diagram of the sencond method is not complete and only the main part is added. If you want to use this method, the input nodes of select the rows and cols should be specifid.
Hope it helps,
Zachary OriginLab GZ office.
quote:
Columns containing text is my problem! first column of the wanted result worksheet contains text (sample names) while other 3 columns are just numeric. each column has column label just as in the pic attached.
when i define c1 terminal on OAGetWorksheet.vi as 0, nothing gets imported. it works fine when c1 is set to 1; ie. skip first column.
Why do text containing columns encumber the exporting when OAGetWorksheet is used? is there any other way of exporting text from origin to labview?
Darko

Edited by - zachary_origin on 04/24/2006 9:55:07 PM
Edited by - zachary_origin on 04/24/2006 10:01:45 PM |
 |
|
|
masterd
Australia
Posts |
Posted - 04/26/2006 : 09:10:24 AM
|
Thank you all Deanna, Easwar and Zachary! At the end I have adopted that simple mod Zachary suggested! It works!
Thanks again
Darko
|
 |
|
| |
Topic  |
|
|
|