<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Splitting comma-delimited float list into floats]]></title><description><![CDATA[<p>Hi,</p>
<p>I have a device sending comma-delimited float lists which come into pd as a byte stream.</p>
<p>They look like this: 123,332.43,-34.4,39,111</p>
<p>I am converting the bytes to text using [bytes2any] which seems to work fine but when I then try and unpack, I get errors.</p>
<p>I tried using [unpack f s f s f s f] (for 4 floats, each with commas in between them) and just not linking up the outlets for the commas, this works but my console gets filled with &quot;unpack: type mismatch&quot;, but my number boxes are getting the floats correctly.</p>
<p>This is okay but I'd rather not have those unpack errors.</p>
<p>So I looked at this <a href="http://puredata.hurleur.com/sujet-6955-total-newb" rel="nofollow">forum thread</a> and tried using [symbol2list] but got the &quot;no method for 'float'&quot; error mentioned in that thread. So I tried putting my message through [symbol] first which gets rid of the error but I have a really weird output. Instead of printing the list it prints:</p>
<p>&quot;print: list l i s t&quot;</p>
<p>for the list contents which seems very strange.</p>
<p>Could it be that putting my message through [symbol] is clearing the message (because it doesn't know what to do) and then when I try and put it through s2l I just get a list made out of the letters &quot;list&quot;?</p>
<p>Here is a kinda pseudo version of my code:</p>
<p>[comport 4 9600]<br />
|<br />
|<br />
[bytes2any]<br />
|<br />
|<br />
[symbol]<br />
|<br />
|<br />
| _ _[ , (<br />
| |<br />
[s2l]<br />
|<br />
|<br />
[print]</p>
<p>(Using the comma there for the message box).</p>
<p>Does anyone have any ideas?</p>
<p>Thanks in advance</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 14:11:47 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/8157.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 05 Mar 2014 18:21:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Splitting comma-delimited float list into floats on Wed, 05 Mar 2014 18:21:49 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>I have a device sending comma-delimited float lists which come into pd as a byte stream.</p>
<p>They look like this: 123,332.43,-34.4,39,111</p>
<p>I am converting the bytes to text using [bytes2any] which seems to work fine but when I then try and unpack, I get errors.</p>
<p>I tried using [unpack f s f s f s f] (for 4 floats, each with commas in between them) and just not linking up the outlets for the commas, this works but my console gets filled with &quot;unpack: type mismatch&quot;, but my number boxes are getting the floats correctly.</p>
<p>This is okay but I'd rather not have those unpack errors.</p>
<p>So I looked at this <a href="http://puredata.hurleur.com/sujet-6955-total-newb" rel="nofollow">forum thread</a> and tried using [symbol2list] but got the &quot;no method for 'float'&quot; error mentioned in that thread. So I tried putting my message through [symbol] first which gets rid of the error but I have a really weird output. Instead of printing the list it prints:</p>
<p>&quot;print: list l i s t&quot;</p>
<p>for the list contents which seems very strange.</p>
<p>Could it be that putting my message through [symbol] is clearing the message (because it doesn't know what to do) and then when I try and put it through s2l I just get a list made out of the letters &quot;list&quot;?</p>
<p>Here is a kinda pseudo version of my code:</p>
<p>[comport 4 9600]<br />
|<br />
|<br />
[bytes2any]<br />
|<br />
|<br />
[symbol]<br />
|<br />
|<br />
| _ _[ , (<br />
| |<br />
[s2l]<br />
|<br />
|<br />
[print]</p>
<p>(Using the comma there for the message box).</p>
<p>Does anyone have any ideas?</p>
<p>Thanks in advance</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats</guid><dc:creator><![CDATA[tsmith]]></dc:creator><pubDate>Wed, 05 Mar 2014 18:21:49 GMT</pubDate></item><item><title><![CDATA[Reply to Splitting comma-delimited float list into floats on Wed, 12 Mar 2014 10:34:43 GMT]]></title><description><![CDATA[<p>*bump*</p>
<p>Hey everyone, sorry I'm bumping this because (although it works) the pd window being filled with &quot;unpack: type mismatch&quot; is very annoying for debugging other parts of my patch.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/2</guid><dc:creator><![CDATA[tsmith]]></dc:creator><pubDate>Wed, 12 Mar 2014 10:34:43 GMT</pubDate></item><item><title><![CDATA[Reply to Splitting comma-delimited float list into floats on Thu, 13 Mar 2014 06:15:33 GMT]]></title><description><![CDATA[<p>so... what are you doing with the numbers? due to pd's message system system they might already be separate float messages. what happens when you print the stream? (using print)</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/3</guid><dc:creator><![CDATA[seb-harmonik.ar]]></dc:creator><pubDate>Thu, 13 Mar 2014 06:15:33 GMT</pubDate></item><item><title><![CDATA[Reply to Splitting comma-delimited float list into floats on Thu, 13 Mar 2014 09:31:50 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Thanks for reply - if I print straight from the stream it is in bytes but if I print after feeding the stream through [bytes2any] I get a line like:</p>
<p>610 , -244 , 48 , -4100 , 4 , 1 , 28 , -1224 , -27771 , 2145</p>
<p>If I just connect straight to the device (through tera term) the line is like:</p>
<p>610,-244,48,-4100,4,1,28,-1224,-27771,2145</p>
<p>So it looks like PD is adding spaces between the commas and numbers, does this mean it has turned it into a list? If so, then I guess that's why [symbol2list] wouldn't work for it.</p>
<p>But how would I cut out the commas and just have a float list I could unpack?</p>
<p>Thanks.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/4</guid><dc:creator><![CDATA[tsmith]]></dc:creator><pubDate>Thu, 13 Mar 2014 09:31:50 GMT</pubDate></item><item><title><![CDATA[Reply to Splitting comma-delimited float list into floats on Thu, 13 Mar 2014 10:40:13 GMT]]></title><description><![CDATA[<p>well yes it is turning it into a list, that's what any2bytes does (did you mean any2bytes?). bytes2any does too and the symbol object turns the first thing it gets into a symbol. In this case it's getting the &quot;list&quot; selector of the list.<br />
anyhow, I'm curious what format you are receiving the byte values as because they appear to be floating point values<br />
maybe try uploading your patch?<br />
again, what information do you need from these values? do you need the values themselves (which are actually floats maybe?)<br />
if they are messages a certain number of numbers long you can use a list object to accumulate like so:<br />
[t l]</p>
<p>and connect the numbers in the left inlet of the list, the output of the list into the trigger, and the trigger into the right inlet of the list.<br />
now have the outlet of this list connect to a 2nd list object, into it's right inlet. after you receive the right amount of numbers bang the left inlet of the latter list and the right inlet of the former (which clears it)<br />
this requires a counter that keeps track of how many numbers have come into the list (for instance [cup])</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8157/splitting-comma-delimited-float-list-into-floats/5</guid><dc:creator><![CDATA[seb-harmonik.ar]]></dc:creator><pubDate>Thu, 13 Mar 2014 10:40:13 GMT</pubDate></item></channel></rss>