T O P I C R E V I E W |
hofmannt |
Posted - 06/07/2007 : 1:55:43 PM Origin Version (Select Help-->About Origin): 7.5 SR6 v7.5885 Operating System: XP Pro
I'm trying to organize and plot data after initial import. I wrote a short script and ran into some problems:
The initial worksheet consists of datasets in the from xy xy xy. The y columns have a column label that I would like to use as the name of the new worksheet. Is there a way do this?
After dividing up my initial worksheet in individual worksheets and doing some math I would like to plot the data and scale it right away. My problem is in line 13: I don't know what to put to address the active worksheet. Also Origin only allows me to use the column name but not col(4). With this I run into problems because the forth column doesn't always have the same column name. I'd appreciate any ideas how to solve this.
Below I attached the code. Thanks a lot for your help!
1 loop (num, 1, wks.ncols/2) 2 { 3 win -a Data1; 4 work-d; 5 for(jj=wks.ncols;jj>2;jj--) {delete %(%H,$(jj));} //delete col greater than col2; 6 work -a 2; 7 work -t 3 4; 8 wks.col3.label$=Ebin; 9 col(3)=1253.56-col(1); 10 col(4)=col(2); 11 work -s 4 0; // select column 4 12 work -p 200 XPSnew; // plot line with template XPSnew; 13 limit active worksheet_col(3); 14 layer1.x.from = limit.ymax; //scales graph 15 layer1.x.to = limit.ymax; 16 win -a Data1; 17 del col(1); 18 del col(1); 19 };
|
1 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 06/07/2007 : 4:04:25 PM Easiest to find the limits while the worksheet is still active, i.e., before plotting. Also, the limit command is usually applied to a Y dataset so you can find both x and y ranges as shown below. Finally, you can avoid window 'flickering' from activating Data1 by using win -o Data1 { }, also shown below...
1 loop (num, 1, wks.ncols/2) 2 { 3 win -o Data1 {work -d}; 4 for(jj=wks.ncols;jj>2;jj--) {delete %(%H,$(jj));} //delete col greater than col2; 5 work -a 2; 6 work -t 3 4; 7 wks.col3.label$=Ebin; 8 col(3)=1253.56-col(1); 9 col(4)=col(2); 10 limit col(4); // find x and y limits 11 work -s 4 0; // select column 4 12 work -p 200 XPSnew; // plot line with template XPSnew; 13 layer1.x.from = limit.xmin; 14 layer1.x.to = limit.xmax; 15 layer1.y.from = limit.ymin; 16 layer1.y.to = limit.ymax; 17 win -o Data1 {del col(1); del col(1)}; 18 };
quote: The y columns have a column label that I would like to use as the name of the new worksheet. Is there a way do this?
Say you want to rename a new wks after the label for column 4...
%A=wks.col4.label$; work -d %A; // duplicate wks as %A
There are more restrictions on worksheet names than there are on worksheet or column labels so the results will probably not be exact. http://www.originlab.com/www/support/resultstech.aspx?ID=1103&language=English#GUI
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/07/2007 4:22:56 PM |
|
|