Anton Schlesiner wrote:
Dear all,
I try to save matrixes with mtx_tab, dynamically.
[no. of col] [dyn. changing array of floats] | | | [l2s] [f $1] [symbol $2] [pack f s] [row $1 $2] [mtx_tab "filename"]
i had a bit of a problem reading your patch. hint: message-boxes are usually written as [bla( to distinguish them from object-boxes which are written as [bla].
This is my approach, the message-box row dumps in this way a symbol that causes a sparse matrix error. I am searching for a solution to get the symbol back to a list inside the row-box.
so what you are really trying to do, is to create a message [row <index> <val1> <val2> .... <valN>(
going the list2symbol route has 2 problems:
small number of atoms _that looks the same_ as as a message with a a larger number of atoms; this does not work, as the "identitiy" is only on a surface level (as you have already discovered)
number. computers (and esp. within the context of Pd) are good in working with numbers and not so good when working with strings. therefore you should keep working with numbers. the conversion between strings and numbers and vice versa is costy (in terms of CPU), due to the nature of symbols (the most string-like native data-type in Pd), it is also costy in terms of memory (and another CPU).
so what is the solution to your problem? well, simply concatenate two lists together:
[row $1( [<list of floats>( | | [list append] | [list trim] |
you will need the [list trim], because the [list append] will prepend the special selector "list" to your message, and you really want the selector "row".
if you are working with an older version of Pd that does not have the [list] objects, consider updating; if this is not an option, there are a number of externals that also provide the functionality of [list append], some of these are: zexy's [glue], iemlib's [iem_append], cyclone's [Append]; you can also construct messages the other way round (seems to be more popular) with [list prepend], resp. iemlib's [iem_prepend] (aka [pp] or [prepend]), cyclone's [prepend], cxc's [prepend] and thomas grill's flext-based [prepend]. most likely i have forgotten 3 or 4 other prepends....
fmga.sdr IOhannes