FB II Compiler
In this example, I save 3 values (columns) for each sample. The result is a tab delimited TEXT spreadsheet of values.
NOTE: TEXT file lines end with a carriage return - CHR$(13).
The PRINT statement automatically places a CHR$(13) after what ever you're printing. You must suppress this with a semicolon.
In this example, I am saving positive values, so I strip the leading space by using MID$.
FN IsFileOpen may be found in your FB help files. It checks to see if the file is already open.
Tabs, commas, spaces, pipes, and any character not commonly used for language and math can serve as a delimiter. Tab, comma and spaces are almost universally accepted as import data file delimiters. However, use tabs. Commas and spaces are commonly found in many data types and parsing the data is then complicated or defeated.
LOCAL FN SaveData ' save as
DEF OPEN "TEXTttxt" ' create a teach text type document
DatafileName$=FILES$(_fSave,"Save horizon data as:","untitled",fvol):' get name
LONG IF LEN(DatafileName$) ' only create a file if they used a filename
AlreadyOpen%=FN IsFileOpen(DatafileName$, fvol)'This FN available from FB help menu
LONG IF AlreadyOpen%=0 'if file not already in use
OPEN "O",1,DatafileName$,,fvol ' open the file to write to now
FOR count=1 TO NumPoints%
PRINT #1, MID$(STR$(DataPoints&(count,1)),2);'col 1
PRINT #1, MID$(STR$(DataPoints&(count,2)),2);'col 2
PRINT #1, MID$(STR$(DataPoints&(count,3)),2);'col 3
PRINT #1,CHR$(13); ' finish line w/ carriage return
NEXT count ' loop to finish writing out the data
BEEP:BEEP ' warn user if file is in use
I just checked DeltaGraph 1.5
It does indeed import tab or comma delimited text files. Also it seems to read the first line as labels, so insert the following line immediately above the FOR/NEXT loop:
PRINT #1, ColumnLabel$(1); CHR$(9); ColumnLabel$(2); CHR$(9); ColumnLabel$(3); CHR$(13);
This will fill-out the labels for each column.