# Graphic and export data from TB to excel

I am new on TB (Bronze). I have two doubts:

1) I would like to know if it is possible to export the results (table with 5 columns) of a program I created to excel in order to graph those results.

2) I am trying to create graphs in TB. I started to learn with a simple program but I don´t understand what is wrong. I followed all the instructions and graph does not appear in output window. See my program below.

Option nolet
Set Window -20,320,-40,180
Set color 1
Box lines 0,315, 0,175
Q = 10
E = 30
K1 = 0.22
K2 = 0.05
DT = 1
set color 1
Plot T, Q
for T = 0 to 315
DQ = K1*E - K2*Q
Q = Q + DQ
T = T + DT
If T >= 200 then E = 0
next T
set color 0
Plot text, at 2,2: "tank.tru"

end

I appreciate someone to help me!

Tks,
Selene

### Plotting

Hi Selene,

You code works fine. It may not be what you expected, but it works, i.e. it draws a box on screen.

I would guess that you wanted to plot a series of points as the values of T and Q change. If so you need to reposition the PLOT statement, e.g.
!Plot T, Q !remove from here
for T = 0 to 315
DQ = K1*E - K2*Q
Q = Q + DQ
T = T + DT
Plot T,Q ! insert here
If T >= 200 then E = 0
next T

Regards
Big John

### Re: Your TB program RUNs ok ...

Selene ... I ran your 'Option nolet' TB program listing -as is - and ... it worked!! I got a full screen graphic with a large rectangle frame and had the "tank.tru" text in the lower lefthand corner of the frame.

OK on the export results from TB to Excel. I need to see your data, in either TB or Excel to create the TB export program. Regards ... Tom M

Thank you again.

### Thanks Tom

The thing is to export results from TB to Excel in order to graph them. When I copy the data I get in the output window I have a figure (bitmap) which can not be converted in useful data for excel (or I don't know how to convert). I can send you a word and an excel file with this. But I don't know how to post an attachment here. Could you tell me how to send this to you?

About using TB for make my graphs is what Iam trying to do. But I really don't understand what is wrong and I have already tried to program without the nolet option. I really thank you for your help.

Selene

### EXCEL and graphics

Hi,

lets assume you have a set of values, e.g. value1, value2 etc
The first job is to put these into a single string e.g.
Let string\$=str\$(value1) & "," & str\$(value2) & "," & str\$(value3) & "," & str\$(value4)
Now print this string to a simple text file
Save the file with the extension .csv e.g. "myfile.csv"

Now insert this line of code in your program:
LET nextprogram\$="!rundll32.exe url.dll, FileProtocolHandler " & "myfile.csv"
CHAIN nextprogram\$,RETURN

What will happen is that your program will chain to and start up Excel and will automatically load your file into Excel and will display the data you have entered.

Big John

### Re Selene's TB programming problems ...

Big John ... From emails Selene and I have been exchanging, the version of TB she is using was "puchased years ago for our lab and nobody uses it".

I think it is unlikely she has access to TB version 5. Accordingly, I don't think she can use the LET nextprogram\$ = ... statement in your message.

In any event I have converted her Qbasic program listing to TB, using BAStoTB.exe, and - with a couple of edits - got the program to RUN and, got the graphic she was hoping for. I've emailed her the converted TB file today. Regards ... Tom M

I will keep in touch and send you my files.

Tks

### Re: Graph TB data and export to Excel ...

Selene ... The answer to question 1 is Yes. I have done this occasionally. The trick is to create a byte file that literally duplicates the manual typing you would do to enter your TB data into an opened Excel file. This is not hard to do, but you say you're a novice TB programmer.

The byte file you would create would contain all of the data characters, plus the TAB characters and the carriage-return and line feed characters your typing would create.

If you could email me a Word file with your data I will create the byte file for you.

Whoops! I've reread your message and think you want to go from Excel to TB. That's easy too. Email me an Excel file. Regards ... Tom M

I'll also try to debug your program listing, although I won't use option nolet. Regards ... Tom M

### I dont realy understand this...

If you are using excel data to make a graph why make a graph with tb why not make an excel graph it just makes more sense

### Sorry I think you didn't understand...

Sir, I think you didn't understand my doubt.