---
name: "vnl-make-matrix"
section: "1"
platform: "linux"
package: "vnlog"
version: "1.40-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/vnl-make-matrix"
---

# vnl-make-matrix(1)

create a matrix from a one-point-per-record vnlog

## NAME

vnl-make-matrix - create a matrix from a one-point-per-record vnlog

## SYNOPSIS

```
 $ cat /tmp/dat.vnl
 # i j x
 0 0 1
 0 1 2
 0 2 3
 1 0 4
 1 1 5
 1 2 6
 2 0 7
 2 1 8
 2 2 9
 3 0 10
 3 1 11
 3 2 12
 $ </tmp/dat.vnl vnl-filter -p i,x | vnl-make-matrix --outdir /tmp --prefix test_
 Writing to '/tmp/test_x.matrix'
 $ cat /tmp/test_x.matrix
 1 2 3
 4 5 6
 7 8 9
 10 11 12
```

## DESCRIPTION

Vnlog represents each "data item" as a line of text. This is very often what one wants, but at times it isn't. One example of this is matrix data: we want each line to contain a whole row of a matrix. This script exists for convenience, to bridge this gap.

The input is an vnlog, coming in on STDIN and/or in files given on the commandline. This vnlog must have at least two fields: the least-significant (slowest-changing) index of each point (must be the *first* field), and as many value fields as desired. These points must be written out in order, and it is assumed that all entries in the matrix are specified. The output is a set of (non-vnlog) matrix files in the directory given in the `"--outdir"` argument. These files are named `"PREFIX_XXX.matrix"` where `"PREFIX"` comes from --prefix (or empty) and `"XXX"` is the field name. These matrices can be loaded into any analysis tool (numpy for instance), or plotted directly with gnuplot:

```
 set size ratio -1
 plot "/tmp/test_x.matrix" matrix with image
 pause -1
```

## REPOSITORY

https://github.com/dkogan/vnlog/

## AUTHOR

Dima Kogan `"<dima@secretsauce.net>"`

## LICENSE AND COPYRIGHT

Copyright 2016 California Institute of Technology.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
