removeRow method
Removes the row at the specified index from the matrix.
rowIndex: The index of the row to be removed.
Returns a new matrix with the specified row removed.
Example:
var matrix = Matrix([[1, 2], [3, 4], [5, 6]]);
var matrixWithoutRow = matrix.removeRow(1);
print(matrixWithoutRow);
// Output:
// 1 2
// 5 6
Implementation
Matrix removeRow(int rowIndex) {
if (rowIndex < 0 || rowIndex >= rowCount) {
throw Exception("Row index out of range");
}
List<List<dynamic>> newData = List.from(toList());
newData.removeAt(rowIndex);
return Matrix(newData);
}