The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 deleting desired columns with script

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tomblue 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
2   L A T E S T    R E P L I E S    (Newest First)
tomblue 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
Mike Buess 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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000