source: sans/Analysis/trunk/Put in User Procedures/SANS_Models_v3.00/WriteModelData.ipf @ 56

Last change on this file since 56 was 42, checked in by srkline, 16 years ago

initial checkin of Analysis v.3.00 files

File size: 1.2 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3Proc WriteModelData(xwave,ywave,delim,term)
4        String xwave,ywave,delim,term
5        Prompt xwave,"X data",popup,WaveList("*",";","")
6        Prompt ywave,"y data",popup,WaveList("*",";","")
7        Prompt delim,"delimeter",popup,"tab;space;"
8        Prompt term,"line termination",popup,"CR;LF;CRLF;"
9       
10        //Print xwave, ywave, delim, term
11       
12        fWriteModelData($xwave,$ywave,delim,term)
13       
14End
15
16Function fWriteModelData(xwave,ywave,delim,term)
17        Wave xwave,ywave
18        String delim,term
19       
20        String formatStr="",fullpath=""
21        Variable refnum
22        //setup delimeter and terminator choices
23        If(cmpstr(delim,"tab")==0)
24                //tab-delimeted
25                formatStr="%15.4g\t%15.4g"
26        else
27                //use 3 spaces
28                formatStr="%15.4g   %15.4g"
29        Endif
30        If(cmpstr(term,"CR")==0)
31                formatStr += "\r"
32        Endif
33        If(cmpstr(term,"LF")==0)
34                formatStr += "\n"
35        Endif
36        If(cmpstr(term,"CRLF")==0)
37                formatStr += "\r\n"
38        Endif
39       
40        Open/D refnum as NameofWave(ywave)+".txt"       //doesn't open file
41        If(cmpstr(S_filename,"")==0)
42                //user cancel, don't write out a file
43                Close/A
44                Abort "no data file was written"
45        Endif
46        fullpath=S_filename
47        Open refnum as fullpath
48       
49        fprintf refnum,"Model data created %s\r\n",(date()+" "+time())
50        wfprintf refnum,formatStr,xwave,ywave
51        Close refnum
52        return(0)
53End
Note: See TracBrowser for help on using the repository browser.