### [Newbie] 2D matrix to 1D matrix ?

Hi,

What would be the most simple and efficient way to convert "[jit.matrix 4 char 1200 700]" to : "[jit.matrix 4 float32 840000 1]" ? (1200*700=840000)

(This is to put this matrix into jit.buffer~ after.)

Thanks by advance,

Alexandre

You can use jit.poke~ to put the signal directly from the 2D matrix

into the buffer. For one cell per sample, use phasor~ with frequency

(sample rate / width) to index dim[0] and so on.

-Randy

On Aug 2, 2008, at 9:20 AM, Alexandre wrote:

>

> Hi,

> What would be the most simple and efficient way to convert

> "[jit.matrix 4 char 1200 700]" to : "[jit.matrix 4 float32 840000

> 1]" ? (1200*700=840000)

>

> (This is to put this matrix into jit.buffer~ after.)

>

> Thanks by advance,

> Alexandre

Well, perhaps it was not really clear, but i don’t want to deal with any audio here, i want to convert the stuff as instantaneously as possible. Just forget my parenthese about buffer~.

The question is only:

What is the most Efficient way to convert a 2D matrix of 1200*700 pixels like [jit.matrix 4 char 1200 700] to a 1D matrix of 840000 pixels(*), and float32 : [jit.matrix 4 float32 840000 1] ?

I should do something like: [uzi 700] -> ….

Thanks by advance,

Alexandre

(*) 1200 * 700 = 840000

In that case, jit.scanwrap is your friend – probably to most efficient way of doing this:

Zachary

**all**of the following text. Then, in Max, select

*New From Clipboard*.

```
----------begin_max5_patcher----------
661.3ocyW9saaBCEF+ZxSgEWmg7wl+t6lzdKlppb.mDWErQfyR1p569.aHkt
RSHgjnbAfrwb366mO9f40YNtKT64Utnui9Exw40YNNltZ5vossiaNae5FVkY
Xtop7btT6N2dOMeu1zOwCkpj+lWpQYLMCo+SAuaPxs4ps5MbsID31dEYlGTs
3kuAztgtTI0RVN2bqeTJXa5tSASmtVHW8bIOUaUrOE6gmiBi7hAfBQyQPRbS
OTvCidpWHqD+0DRB3EDfAZTWPK4U0tgoEJYu.SShZBS.zbF2d5P.qsiP14Fn
ou2lMq4z7IxPvCsbCSq4RD4mnbltTrGIjZEB5ZNdjRlBRAKFImGMmLXdQn8V
VTsZqXXeRFvm3KxmTyTKgXtDa7LMrmMyUY79uQqHLI0lm20cd8wfTAHd3imd
Ye2znaS10E.wjIvPJN5lxvqBOJ1IjYpciFHwGw1PXncUgw9gDeyrYTOieBi9
EYEgAlvRCtMoER9tZm8oZNMzosRiec0GESSIHR.BFMqhtnjG.LoMDKLg10i3
iQwZo9bWUv6QhyhsZsRNLGfOygvS6VHnykmxqKXxUtW2ZBm6Z.+SuFfPnW20
.j.6WbhgaWswykCzivARrYFEv9uWCLFOYLfO39AB4srRfTIp30EBRWyJQAnf
QCIxTJBX2mEfie7pAbDVUkxj6JYEc35rJZBSgWPj8hcGD2GfYdP2MB4++6BF
Y1z+GoXkZaYZmHZ+LA5cclwqzBoIuu2XR9vXVKxx3x96uMWjUnp2PbqD.RnW
PM.RLKB8wGZfdZvo5qoTiOOoNQEAiPQQObJx+gSQM+svkjgYKM0lg0zXhZkL
FsdWo2XTD8hfWbhoJUheWiIpzvQnTxDXWci2l8O.Wmj7R.
-----------end_max5_patcher-----------
```

Thats’s perfect, thank a lot !

Note: this "jit.scanwrap" was not in the jitter.overview.maxpat..