TAB command in Pbasic

I was looking around in the various forums and things and I wasn’t able to find any documentation discussing the tab character in PBasic. Specifically in its relation to debug statements (we would like to be able to dump debug data easily from the debug window into an excel spreadsheet.) Our problem now, with the tab command is the necessity of dumping the data into a word document and replacing all of the spaces in between the columns of data with tab characters. It’s somewhat inefficient. Our thinking was it would be nice to be able to copy and paste these multiple columns of debug data directly into Excel.

A tab is an ASCII character value 9. Try sending debug 9 and see if it gives a tab.

Just tried it myself:


debug "A"
debug 9

in the main loop spits out A’s separated with tabs.

For all the ascii characters, http://www.asciitable.com .

I thank you for the assistance. It seems like excel may have some difficulty dealing with tabs from the debug window… but, the ASCII does separate the data enough to parse it, so it’s okay. (Try copy and pasting the A’s into excel.) My problem was the data wasn’t automatically behaving like other tabbed data that one would copy and paste into excel… I was curious. Thanks again.

Ooo yeah… your A’s will work, I think… but I’m looking at multiple variables… p1_y, p1_x, PWM1, and PWM2 in one debug statement…

debug DEC p1_y, 9, DEC p1_x, 9, DEC PWM1, 9, DEC PWM2, CR

You could separate fields with commas and linefeeds, save the data to a file with a .csv (comma separated values) extension and open it in excel.

But I have a question for you:
How do you copy and paste data from the debug window?

Just highlight all of the data and Ctrl+C, Ctrl+V it. I’ll probably just stick to parsing…

Attached is an example of me shaking around the joystick a bit

I’m sure you’ve thought of this, but you can add another debug statement outside of the main operational loop that’ll label your columns for you for easy, easy dumping and graphing…

debug p1_y, 9, p1_x, 9, PWM1, 9, PWM2, 9, cr

Doing that outside the loop will run that code only once, as opposed to the 38.687 (or whatever) times per second that the other observed variables are sent.

debug data.xls (33 KB)


debug data.xls (33 KB)

*Originally posted by virusmirusne *
**Just highlight all of the data and Ctrl+C, Ctrl+V it. **

I thought I tried that, but on this laptop keyboard, I had hit [Fn] instead. I should be more awake by this time in the day.:rolleyes:

(Understandable… these stupid laptop keyboards can be annoying in their layout… my new Toshiba doesn’t have a serial port… so I have to program off my server. This, of course, is also fun at this hour of high usage.)

*Originally posted by virusmirusne *
**(my new Toshiba doesn’t have a serial port… so I have to program off my server. This, of course, is also fun at this hour of high usage.) **

You can use a USB to Serial adapter for programming. Just make sure you don’t get one for PDA’s (they’re not standard serial ports).

Back in the days of yore, spreadsheets could import text files in which data was separated by “,” as in

“2”,“5”,“seventeen monkeys”,“0”<cr>.

HTH