failoflife,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(function() {
var $rows = $("#myTable tr");
$("#rowCount").click(function() {
alert("Matrix = " + JSON.stringify(matrixArray($rows)))
});
function matrixArray(rows) {
return $.map(rows, function(tr) {
return [$.map($("input", tr), function(input) {
return +input.value || 0
})]
})
}
});
</script>
</head>
<body>
<button id="rowCount">Count 'Em</button>
<br />
<table id="myTable">
<tr>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
</tr>
<tr>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
</tr>
<tr>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
<td>
<input type="text">
</td>
</tr>
</table>
</body>
</html>