n4ze3m / matrix2d

A package for mathematical 2D array functions and manipulations in Dart, similar to NumPy
https://pub.dev/packages/matrix2d
MIT License
16 stars 3 forks source link

Is there any way to do slicing? #3

Closed benboughton1 closed 3 years ago

benboughton1 commented 3 years ago

Is there a way to do array slicing as per this numpy example?

https://www.w3schools.com/python/numpy/trypython.asp?filename=demo_numpy_array_slicing_2d3

n4ze3m commented 3 years ago

yes :) added slicing support (latest version)


 var sliceArray = [
    [1, 2, 3, 4, 5],
    [6, 7, 8, 9, 10]
  ];

  var newArray = m2d.slice(sliceArray, [0, 2], [1, 4]);
  print(newArray);
// [[2, 3, 4],[7, 8, 9]]
benboughton1 commented 3 years ago

Fantastic. Thank-you @NazeemNato