## Writing to file using simPackFloatTable

Typically: "How do I... ", "How can I... " questions
atoz
Posts: 57
Joined: 18 Oct 2013, 09:02

### Writing to file using simPackFloatTable

Hi,

I'm trying to record joint values of my robot to a file. I've been following the joint recorder method and attempting to convert the recorded data table to a string using simPackFloatTable but it doesn't seem to work. The method returns webdingy symbols as output in the test output file. My test code is as follows:

Code: Select all

	file = io.open("folder\\test.txt", "w")
data={123.234,123.123}
data_s= simPackFloatTable(data)
print(data_s)  -- prints ¤w÷B·>÷B

file:write(data_s)
file:flush()
file:close()
Any idea what I am doing wrong?

Thanks

coppelia
Posts: 7543
Joined: 14 Dec 2012, 00:25

### Re: Writing to file using simPackFloatTable

Hello,

simPackFloatTable and similar will generate a data buffer, that is not printable (or at least, it will just give you garbage). For each value in the table it will create exactly 4 bytes.

What exactly is you intent by packing your data? Packing data is usually used to abstract the data for the time of sending/storing it, but also to minimize the amount of data. After packing the data, you will always have to unpack it again.

Cheers

atoz
Posts: 57
Joined: 18 Oct 2013, 09:02

### Re: Writing to file using simPackFloatTable

Thanks. It seems I didn't understand the abstraction of packing data. My intention was to convert all joint values to a single string using simPackFloatTable to make it easier to write the values to a file. I didn't realise the data representation is changed completely.

coppelia