How to load .mtx file into max/msp

wiccy's icon

Hi All.

I have some data which is in a format of .mtx. Which is a M by N matrix. Anyone knows how to import this data into Max as a stream which row value is the list and column represents the channel.

Thanks

Jiajun

Jan M's icon

Is it a text-based file format? If yes JavaScript would be a possibility.
j.

wiccy's icon

Hi Jan.

Yes, it is text-based format. Can you be a bit more specific as I never use JavaScript before.

Thanks

Jan M's icon

Hi wiccy,
I am not sitting at a computer right now. But take a look at the js file-object docomentatiom and also at the [filein] object.
J

Jan M's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here is an example of how to read a (text) file. Depending of the character encoding of the file you might create your one lookup-table i order to translate back into readable characters.

Of course you still have to do the parsing into a usable format....

Jan

wiccy's icon

Thank you so much Jan. This really helps.
Now I can load the file in, but the problem now is how to pack them back into a stream of data. like originally: 0.2 0.3 0.4 now becomes: "0" "." "2" "SPACE" "0" "." "3" .......