Your problem is a very specific one. I don’t see how this will be of any use to anybody but yourself.

There is no ‘one line solution’.

There are many ways to approach indexing problems, I like to use scalar indexing when possible:

```
Ncolumns = size(Matrix,1);
Nblocks = floor(Ncolumns/4); %number of 4-line blocks (excluding the last block if it is not a full 4-lines)
IndexVector = (1:3)'*ones(1,3) + ones(3,1)*(0:2) * Ncolumns; %this gives 3 lines as specified.
IndexVector = [IndexVector(:); 4]; %this adds the first element of 4th line, as spec.
IndexVector = IndexVector*ones(1,Nblocks)+ones(10,1)*(0:Nblocks-1)*4; %this repeats the above for rest of blocks.
IndexVector = IndexVector(:)'; %make row vector
vector=Matrix(IndexVector);
if mod(Ncolumns,4) %this deals with the last partial block
subMat=Matrix(Nblocks*4+1:end,1:3);
vector=[vector subMat(:)'];
end
```

solved Convert Matrix to Vector [closed]