Author |
Topic  |
|
ClemensObergfell
Germany
12 Posts |
Posted - 12/02/2014 : 04:47:26 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0 G (32-Bit) SR1 Operating System: Windows 7 Enterprise
Dear Origin-Support team!
I have a still unsolved problem. I'm asking again from this thread:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=20111
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;
Do I have to rename the variables for the second time it goes through the loop(ii,1,wks.ncols-1) part?
Thank you very much in advance.
Greetings, Clemens |
|
cdrozdowski111
USA
247 Posts |
Posted - 12/02/2014 : 06:59:17 AM
|
Notice that in your second loop() command, you check to see if the first 5 characters in the column long name == Integrated Y. Of course, there are more than 5 characters in Integrated Y. You need to increase the number of characters checked. It's easy to overlook such things :)
Maybe this solves your problem?
str$ = wks.col$(ii).lname$;
if(str.Left(5)$==Integrated Y) // <-- change 5 to 12
{
col(Bruchenergie)[row] = max(wcol(ii));
row++;
}
BTW, it is generally good practice to put strings that have spaces in them, e.g. Integrated Y, in quotes, e.g. "Integrated Y". While it may not be the case with your particular code, having the space in a string can cause problems in other types of code. |
Edited by - cdrozdowski111 on 12/02/2014 07:11:12 AM |
 |
|
ClemensObergfell
Germany
12 Posts |
Posted - 12/04/2014 : 01:28:06 AM
|
I have changed the "5" to "12" and added this "" to Integrated Y and now I get the values.
Thanks again for your help!
As you said it, it's easy to overlook such things if you're not too familiar with coding in general...
Thank you :) |
 |
|
|
Topic  |
|
|
|