How to add a comma in a list?

Brantiko's icon

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?

Max Patch
Copy patch and select New From Clipboard in Max.

Yours Brantiko

Christopher Dobrian's icon

How about this?

Max Patch
Copy patch and select New From Clipboard in Max.

regexp " " @substitute ", "

Brantiko's icon

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

Tobias Rosenberger's icon

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

Brantiko's icon

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

Brantiko's icon

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

Tobias Rosenberger's icon

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

Brantiko's icon

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

exeterdown's icon

This is great, thanks.
I'm just having some problems with longer lists and shorter times...

list and line.maxpat
Max Patch