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
 Saving analysis to worksheet

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
rrahul 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;
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess 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

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