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
 Origin Forum
 Find maximum values with import labtalk script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ClemensObergfell

Germany
12 Posts

Posted - 11/10/2014 :  09:47:38 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0 G (32-Bit) SR1
Operating System: Windows 7 Corporate

Dear Origin Support Team,

What would be an easy solution to this task:
- I import several ASCII files into the workbook (like columns A to F in the picture)
- then I want to open a new column (column G, see in the picture)
- in this column there should be the maximum value of each "Kraft" column.

I want to write the labtalk script at the end of the import assistant where I already have the code to plot the data.

I would start with

worksheet -a 1

to open a new column, but then I have no idea to go on...

Thanks in advance for your help.

Greetings, Clemens

greg

USA
1378 Posts

Posted - 11/10/2014 :  11:40:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
// Add a column and set its Long Name
wks.addcol();
wcol(wks.ncols)[L]$ = Max Werte;
// Initial row for output
row = 1;
// Loop over all columns
loop(ii,1,wks.ncols-1)
{
// Get column Long Name
str$ = wks.col$(ii).lname$;
// Test if it's a 'Kraft' column
if(str.Left(5)$==Kraft)
{
col(Max Werte)[row] = max(wcol(ii));
row++;
}
}
Go to Top of Page

ClemensObergfell

Germany
12 Posts

Posted - 11/11/2014 :  06:57:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much!
It works fine, but only after I deleted the comments out of the script.
You helped me a lot. Thanks!

Edit:
I have now added integrations of the imported columns and wanted to get the max values of the "Integrated Y1" to "Integrated Y5" columns in the same style as before.

I have this script now but I don't get any values in the new column "Bruchenergie". What could I change to make it work?

wks.addcol();
wcol(wks.ncols)[L]$ = Max Werte;
row = 1;
loop(ii,1,wks.ncols-1)
{
str$ = wks.col$(ii).lname$;
if(str.Left(5)$==Kraft)
{
col(Max Werte)[row] = max(wcol(ii));
row++;
}
}
;
integ1 iy:=(Col(2), Col(1));
integ1 iy:=(Col(4), Col(3));
integ1 iy:=(Col(6), Col(5));
integ1 iy:=(Col(8), Col(7));
integ1 iy:=(Col(10), Col(9));
wks.addcol();
wcol(wks.ncols)[L]$ = Bruchenergie;
row = 1;
loop(ii,1,wks.ncols-1)
{
str$ = wks.col$(ii).lname$;
if(str.Left(5)$==Integrated Y)
{
col(Bruchenergie)[row] = max(wcol(ii));
row++;
}
}
plotxy iy:=((2,1),(4,3),(6,5),(8,7),(10,9)) plot:=202;


Edited by - ClemensObergfell on 11/11/2014 10:14:13 AM
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