How to add a comma in a list?

Aug 2, 2012 at 2:02pm

How to add a comma in a list?

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. –
#63827
Aug 2, 2012 at 2:12pm

How about this?

regexp ” ” @substitute “, “

– Pasted Max Patch, click to expand. –
#230138
Aug 2, 2012 at 2:26pm

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

#230139
Aug 2, 2012 at 2:48pm

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

#230140
Aug 2, 2012 at 2:49pm

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

#230141
Aug 2, 2012 at 2:50pm

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

#230142
Aug 2, 2012 at 3:00pm

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

#230143
Aug 2, 2012 at 3:06pm

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

#230144

You must be logged in to reply to this topic.