| Author |
Topic  |
|
|
tomblue
Germany
22 Posts |
Posted - 09/01/2006 : 06:55:04 AM
|
Origin Version (Select Help-->About Origin): 7.5 SR0 Operating System:Win xp pro
Hi! I got a simple problem: I like to import ascii data from files containing x and y column. Importing options do not provide a filter to import just one x column (x column is the same in every datafile, so no need to have e.g. 300 x columns in one wks) with all the y columns. I thought it would be easy to use a script to delete all x columns except the first. That will be every second column to be deleted beginning with the 3rd column in the desired wks. The intention is to get rid of too many columns and the main aspect is to fit these data with a script that doess not understand that the wks contains xy, xy and so on. It works fine when the wks 1st column is of type x and the rest of type y. Deleting by hand takes a lot of time when having many datafiles (300 & more). So, I see two possibilities: 1. alteration of the existing script; 2. set up an easy short script for deleting the desired columns - 2nd seems to be more efficient, because altering an existing script needs to be understood first and this takes probably more time. Anyway here it is: ---------------------------------------- for (test=2; test<=%(data2,@#); test++){ Result3_a[test-1]="%A"; nlsf.begin(); nlsf.func$="voigt"; nlsf.fitdata$=%(data2,test); nlsf.x$="data2_A"; nlsf.constr$=""; nlsf.p1=100; nlsf.p2=4.46; nlsf.p3=500; nlsf.p4=0.01; nlsf.p5=0.02; nlsf.tolerance=0; nlsf.fit(25); Result3_b[test-1]=nlsf.p2; Result3_c[test-1]=nlsf.p3; Result3_d[test-1]=nlsf.p4; Result3_e[test-1]=nlsf.p5; nlsf.end(); }; --------------------------------
Btw, another problem is that this script creates only one graph window containing every fit function but only the first experimental data of the wks. I thought it should create a graph window for every graph with its fit function.
Maybe it is possible to change the 'for-loop' with 2*k to get access to every 2nd column starting with the 2nd? I don't know how alter this loop. Can someone help, please? Maybe I overlooked a 3rd altenative?!
Thanks again to Mike Buess for supporting in setting up the script that time. Best regards Tom |
|
|
Mike Buess
USA
3037 Posts |
Posted - 09/01/2006 : 08:50:03 AM
|
Hi Tom,
It's easiest to delete all but the first X column...
for(i=2;i>0;i++) { if(i>=wks.ncols) break; del wcol(i+1); };
quote: Btw, another problem is that this script creates only one graph window containing every fit function but only the first experimental data of the wks. I thought it should create a graph window for every graph with its fit function.
Try plotting all columns first and modifying the script something like this (assumes data2 is active)...
for(i=2;i>0;i++) { if(i>=wks.ncols) break; del wcol(i+1); }; %W=%H; wo -s 0 0 0 0; // select all columns wo -p 200; // plot as lines for(test=2; test<=%W!wks.ncols; test++) { Result3_a[test-1]="%A"; nlsf.begin(); nlsf.func$="voigt"; nlsf.fitdata$=%(%W,test); nlsf.x$="%W_A"; // remaining commands (no change) };
Have you tried the MultiFit addon? It should work fine for this task.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 09/01/2006 09:09:33 AM |
 |
|
|
tomblue
Germany
22 Posts |
Posted - 09/02/2006 : 03:44:12 AM
|
Hi Mike!
thanks for fast help. I will try that and Multifit.opk of course. Thanks a lot for your support!
Best regards,
Tom |
 |
|
| |
Topic  |
|
|
|