Author |
Topic  |
|
rrahul
USA
Posts |
Posted - 08/10/2005 : 3:48:56 PM
|
Origin Version (Select Help-->About Origin): Origin 7 SR4 Operating System: WIN XP
I would like to import multiple files, plot the columns B and C (after removing the first row). Also, calculate the mean (and sd) for each col (B and C) and save it in one worksheet along with the file name to which they correspond. I have the following code for importing and plotting but don't know how to do the rest. Can you help? Thanks, Rahul
//////////////////////////////////////////////////////////////////////////////// // Main Section // This code calls other specialized sections to accomplish the main task. // // Execute script: run.section(trace,Main); // Operations: // For analysing and plotting OPT data // 1. Import each trace file into a new worksheet // 2. Remove the first row // 3. Find the mean and the standard deviation // 4. Save it to a worksheet // 5. Plot all data in worksheet to a custom graph window // //////////////////////////////////////////////////////////////////////////////// [Main] FDLOG.multiopen.colview=12; // new property for dialog options FDLOG.UseGroup(Ascii); //Open ASCII files if (FDLOG.multiopen()==0/0) return 1;
loop(ii,1,FDlog.MultiOpen.Count) { FDlog.Get(A, ii); win -t data; open -w %A; %W = %H; /* save worksheet name */ win -ch 1; mark -d %W_b -b 1 -e 1; // mark -d %W_c -b 1 -e 1;
run.section(,Plot,%W); //Run Plot section }
[Plot] win -t plot plotopt G%W; //customized template //page.active=1; // activate layer 2 layer -i %1_b; //Include wks data in the active layer layer -i %1_c; limit %1_a; layer.x.from = 0; layer.x.to = limit.xmax*0.05; layer.y.from = 0; layer.y.to = 500; set %1_b -cl 3; set %1_c -cl 2; label -s -p 75 10 G%W;
return 0;
|
|
Mike Buess
USA
3037 Posts |
Posted - 08/10/2005 : 4:35:49 PM
|
This should work...
[Main] FDLOG.multiopen.colview=12; // new property for dialog options FDLOG.UseGroup(Ascii); //Open ASCII files if (FDLOG.multiopen()==0/0) return 1;
/* prepare results wks */ win -t data; %R=%H; del col(2); wks.col=2; wks.insert(mean1 sd1 mean2 sd2); // insert new cols
loop(ii,1,FDlog.MultiOpen.Count) { FDlog.Get(A, ii); win -t data; open -w %A; %W = %H; /* save worksheet name */
win -ch 1;
mark -d %W_b -b 1 -e 1; // mark -d %W_c -b 1 -e 1;
/* column statistics */ FDlog.Get(F, ii, 1); // file name only (no extension) %R!cell(ii,1)$=%F; sum(%W_B); %R!cell(ii,2)=sum.mean; %R!cell(ii,3)=sum.sd; sum(%W_C); %R!cell(ii,4)=sum.mean; %R!cell(ii,5)=sum.sd;
run.section(,Plot,%W); //Run Plot section }
Mike Buess Origin WebRing Member |
 |
|
|
Topic  |
|
|
|