Scientific Calculator
godbreak/matlab
By Guangmu Zhu
The script contains some functions as Matlab
Tagged:
var subm = function(x, row, col) {
size = dim(x);
if len(size) != 2 ->
error(concat("Not a matrix: ", string(x)));
if len(dim(row)) != 1 ->
error(concat("Not a list: ", string(row)));
if len(dim(col)) != 1 ->
error(concat("Not a list: ", string(col)));
for i in row ->
if i < 1 or i > size[0] ->
error(concat("row out of range: ", string(i)));
for i in col ->
if i < 1 or i > size[1] ->
error(concat("col out of range: ", string(i)));
subm = zeros(len(row), len(col));
for i in range(len(row)) ->
for j in range(len(col)) ->
subm[i][j] = x[row[i] - 1][col[j] - 1];
subm
}
0 Comments
Sign in to leave a comment