Forums > MaxMSP

How to add a comma in a list?

August 2, 2012 | 2:02 pm

Hi!
I want to create a list of numbers with MAX to copy it in a C code. I am using a multislider for that.
The values inside the list coming from the multislider object needs to be seperated by a comma… But how can I manage it?
I tried to add the ASCII value of a comma (44).. but unfortunately that doesnt work (look at my patch)

Any ideas?

Yours Brantiko

– Pasted Max Patch, click to expand. –

August 2, 2012 | 2:12 pm

How about this?

regexp " " @substitute ", "

– Pasted Max Patch, click to expand. –

August 2, 2012 | 2:26 pm

Hi!
Thank you, that looks good.. but I want to show the list in a textedit object because I need to copy the data out of max.
Illustrated in a textedit object the backslash is there again.. using a commentbox works without a backslash but there I cant copy the data.

BTW.. I am new at max and I have still problems dealing with the different datatypes like Lists,Symbols and stuff. Is there a tutorial dealing with it? Would be fine to know why different kind of objects show the same data in a different way..

Yours

Brantiko


August 2, 2012 | 2:48 pm

sprintf %f, %f, %f

just write as many variables like this in the sprintf object as your multislider provides..

if you have ints instead of floats just substitute the f with i


August 2, 2012 | 2:49 pm

Another problem with the regexp object is that it cuts of the list after 40 items? Why?


August 2, 2012 | 2:50 pm

Hi Tobias!
The Number of variables is adjustable!
Thats why sprintf is not the very best solution.


August 2, 2012 | 3:00 pm

then connect an iter to the left output of multislider, then a sprintf %f, – with the comma – then a zl group with an argument twice the value of your values in the multislider

you can always adjust the argument of zl group via its second inlet


August 2, 2012 | 3:06 pm

As often I solved the problem without understanding it.
Using "append ," works.


Viewing 8 posts - 1 through 8 (of 8 total)