How do I import a file that has just a list of numbers (say 5 9 6 2 into an array while resizing the array at the same time? Mind you this is not an audio file so soundfiler doesn't help here...
-
This one is driving me crazy...
-
Anyone? Please?
-
Take a look at Help Browser/2.control.examples/15.array.pd. It shows how to load and save the contents of an array to text files.
-
Thanks for your quick response Maelstorm but you missed the point. I probably didn't explain myself well enough... What if the array that I am loading the file into is larger then the file? In that case I need to resize the array. I guess what i am trying to know is the size of the array while loading it. So
[;table_name read file_name( is not enough since it doesn't accept the -resize flag. Any ideas? -
have you considered not resizing the array? i have had the same thought, but i just tend to use arrays that are bigger than i need them to be, if i'm using them to store things of variable length.
why not just default to a larger array? the obvious answer might be cpu usage, i suppose. anyway, i'm interested in the conversation around this issue, but i'm also not in a position to code or test anything. maybe in a couple weeks.
d
-
@deerell the thing is that if you want to use the stored numbers for something you need to get them out of the array and so need someway of knowing when you've reached the last number. if your array is bigger then what is in the original file then the remainder sometimes returns zeros and sometimes returns the last number over and over...
-
Load the file in [textfile] and send the output into
. Use that to resize the array, then send the list to [tabset] to fill the table.
[textfile]
|
[t l l]
| |
| | |
| [; mytable resize $1(
|
[tabset mytable]That assumes the file is a one-line list. If not, make a list with X[t l].
-
Thanks! this solution works like a charm. By the way, is there a way to achieve this in PD Vanilla?
-
Yeah, actually. Replace [tabset] with this:
|