The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Coding error using Import Wizard
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

onsight8c

Germany
11 Posts

Posted - 01/08/2015 :  08:31:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: 9.0.0G SR2 b87
Operating System: Win7x64

Hey everybody,

it has been some years since I last asked for some help here at the originlab forum. But today I'm stuck in a -most probably- very simple coding problem, again.

Basically, I want to import the four data files named "Messwerte----CHAx CAL" via the import wizard.


Then I have to extract column 3 from those files into a new workbook ("Zusammenfassung" or results) and label the copied data according to the number of the data file ("Messdose 1" to "Messdose 4" in the comment line). The time stamp in column A(X) is copied only once from any file. When I do that manually, it looks like the following:


But as I have some hundreds of data files, I need a script that produces the results workbook automatically. I used to implement some Labtalk script at the end of the import wizard where you can set advanced filter options. There I put the following code to be run after each single imported file:


%R=%H; // Store workbook name.
%T="Zusammenfassung Zugkraefte"; // Define window name for tensile force results.
itest=exist(%T);
if (itest==2)
{
win -a %T; // Activate tensile force Results Window.
wks.addCol(); // next column
nn=wks.nCols;
wks.col$(nn).type=1; // Make data in col(nn) type Y.
}
else {
newbook name:= "Zusammenfassung Zugkraefte"; // Create tensile force results workbook.
nn=wks.nCols;
}
Col($(nn))[L]$="Zugkraft";
Col($(nn))[U]$="kN";
Col($(nn))[C]$="Messdose"$(nn-1);
range rr=[%R]1!Col(3), tt=[%T]1!Col($(nn)); // Assign datasets for copying using range notation. Copy column 3 (tensile force) from source file CALx to Col(nn) in %T
colcopy irng:=rr orng:=tt; // Copy Y data.


The result is this with several errors:


The errors are:

  • Longname, Unit and Comment are written in every CHAx-file except in CHA1 (should only be written in "Zusammenfassung" workbook)

  • in all CHAx workbooks "Messdose 1" is written as comment: at least it should be number 1 to 4 - but still incorrect as mentioned above

  • only y-values of CHA4 have been written to the generated "Zusammenfassung" workbook and labeled incorrectly with "Messdose 1" instead of "Messdose 4"



Does anyone of you has an idea where the error is in my code? I don't get it after several hours of bug-chasing

Here are the data files:
http://www.originlab.com/ftp/forum_and_kbase/Images/data-files.zip


The import filter file .oif
http://www.originlab.com/ftp/forum_and_kbase/Images/Spider-Rohdaten-Import.zip

Thank you all in advance for your support!
Boris

lkb0221

China
497 Posts

Posted - 01/08/2015 :  10:03:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, Boris

Can you send an email to <tech@originlab.com> ? So that I can send you back the filter I made.

Zheng
OriginLab
Go to Top of Page

onsight8c

Germany
11 Posts

Posted - 01/08/2015 :  10:15:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hey Zheng,

I just wrote you an email.

cheers,
Boris
Go to Top of Page

lkb0221

China
497 Posts

Posted - 01/08/2015 :  11:03:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The key is using Start New Columns as import mode and do partial import in Import Wizard.

Here is the script that runs in the end:
// Start
// Set long name, units and format for column 1
col(1)[L]$="Uhrzeit";
col(1)[U]$="hh:mm";
wks.col1.SetFormat(3,3);
wks.col1.type = 4;

for (int col = wks.ncols; col >= 2; col = col - 2) {
// Set long name and units for rest of the columns
col($(col))[L]$ = "Zugkraft";
col($(col))[U]$ = "kN";
col($(col))[C]$ = "Messdose $(col / 2)";
// Delete duplicated time columns
if (col != 2) {
range rr = $(col - 1);
delete rr;
}
}
// End
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000