Author |
Topic |
|
dalee
Ireland
7 Posts |
Posted - 03/29/2010 : 11:48:58 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR6 Operating System: Win 7
I am wondering is there any easy way to extract and replot specific data points from a existing graph. At present I am selecting the points with the data selector and pasting into a new workbook but I am sure there must be a quicker way, perhaps extracting the data from the data annotation tool? |
|
Penn
China
644 Posts |
Posted - 03/30/2010 : 03:38:40 AM
|
Hi,
You can first mask the points you want to extract in the graph. Then go back to the source worksheet and select menu Worksheet: Extract Worksheet Data. In the Extract Worksheet Data dialog, select the column of the plot for If Test, column B for example, and then use the LabTalk function ismasked to set the condition, here is ismasked(i, col(b)). Click the OK button and get the masked data to a new workbook.
Penn OriginLab Technical Services |
|
|
dalee
Ireland
7 Posts |
Posted - 03/30/2010 : 06:46:07 AM
|
Thanks for that. That worked quite well although I had problems using the regional mask tool to select the points and had to mask the individual points from the worksheet using the mask range button as not all the data points were displayed on the graph even though I had turned off speed mode (I do have 24000 data points in the graph). Do you know of a reason why this might be? It is for this reason that I had suggested using the data reader / data annotation tool as you can use the cursor keys to move to the correct data point even if it is not displayed whereas as far as I can see, this is not possible with the regional mask tool. |
|
|
easwar
USA
1964 Posts |
Posted - 03/30/2010 : 10:58:08 AM
|
Hi dalee,
Look at the script example on this page: http://wiki.originlab.com/~originla/wiki/index.php?title=Script:Getting_Points_from_Graph In particular, the 2nd example under Data reader.
To run the script, copy and paste it into Script window and the select all lines and press enter, with your Graph being the active window.
So you could just take that script and modify that to say write the values to a worksheet, to get the desired points from your graph.
Easwar OriginLab |
|
|
dalee
Ireland
7 Posts |
Posted - 03/30/2010 : 1:34:27 PM
|
easwar, Thanks a million for that link. That code is exactly what was required. I simply added 3 lines to the code in the quittoolbox section creating a new book and setting Col(1) as dsx and Col(2) as dsy. I also then saved the full script as a labtalk script file so as not to have to recopy the full text everytime. If anyone else is interested, I have copied the full script below dalee
@global = 1; dataset dsx, dsy; // Create two datasets to hold the X and Y values dotool 3; // Start the tool // Define the macro that runs for each point selection def pointproc { count++; // Increment count dsx[count] = x; // Get the X coordinate dsy[count] = y; // Get the Y coordinate } // Define a macro that runs if user presses Esc key, // or clicks the Pointer Tool: def quittoolbox { count=; for(int ii=1; ii<=count; ii++) { type $(ii), $(dsx[ii]), $(dsy[ii]); } newbook name:="Vred points"; //create new workbook called Vred points Col(1)=dsx; Col(2)=dsy; }
count = 0; // Initial point type "Click to select point, then press Enter"; type "Press Esc or click on Pointer tool to stop"; |
|
|
|
Topic |
|
|
|