Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
carsten
Posted - 12/15/2008 : 1:40:13 PM Origin Ver. and SR (Select Help-->About Origin): Operating System:
I try the to calculate the accumulative hours with the following code:
// open script window to show prompts ty -a;
GetString (Enter Source Worksheet name) (RawData); %P=%B; type "Source Worksheet: "%P; // %Q="NormData"; // Target Wks get %P_Lamp -e TotalMeas; // Total Measurements NoLamps=1; GetNumber -s (Number of Lamps of same configuration) NoLamps; NoLamps=; // get Common_Lamp -e NoLamps; // Number of Lamps // no of measurement of each lamp: NoMeas NoMeas=TotalMeas/NoLamps; // must be an integer if (mod(TotalMeas ,NoLamps) > 0) type -b "mod(TotalMeas ,NoLamps) > 0"; NoMeas=; // calculate cumulative hours for each lamp For (i=1; i<=TotalMeas;i+=NoMeas) %P_Std[i]=0.1; // initial time For (ii=1; ii<=NoMeas-1;ii++) { S1=(%P_Date[ii+1]-%P_Date[ii])*24.0 + (%P_TIME[ii+1]-%P_TIME[ii])*24.0; %P_Std[ii+1]=%P_Std[ii]+S1; // check parameter type "Std[ $(ii)] = $(%P_Std[ii+1]) == $(%P_Std[ii]) + $(S1)"; }; };
the wks with input and output date looks as follows:
The problem is: why works the code up to Std[33] and fails for the next steps?
Any hint is appreciated
Carsten
1 L A T E S T R E P L I E S (Newest First)
carsten
Posted - 12/16/2008 : 04:34:01 AM Meanwhile I could resolve the problem:
Due to a copy (Excel) paste (Origin) process part of the data was 'infected'. When copied into a new Excel sheet and from this wks a second copy action was made then subsequent pasting the data into an Origin wks the code works as expected.