cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

new slicing options for matrices

☐ cool new feature
☑ could help many users!

☐ removes a „bug“

☐ nice to have

☐ nobody needs it

 

Indexing/Slicing of Matrices just works with indices which count from the start of the matrix:

What is the JSL Matrix? 

 

counting from the back or leaving the start or end open doesn't seem to work:
Collection of "funny" Jmp newbie questions 

 

my wish:

add the missing functionality such that indexing like this is also possible:

mat[1::-1];
mat[1::];
mat[::-1];
mat[::];

mat[::, x] is already possible as mat[0,x]

 

more wishes submitted by  hogi_2-1702196401638.png

 

10 Comments
Status changed to: Acknowledged

Hi @hogi, thank you for your suggestion! We have captured your request and will take it under consideration.

Status changed to: Investigating
 
mia_stephens
Staff

@hogi , this and other approaches for both slicing and masking are being explored to provide more succinct ways to manipulate matrices and lists. The challenge is to make sure we don’t paint ourselves into a corner technically or with the JSL syntax.

jthi
Super User

Also consider negative indexing for lists (similar manner as Python for example).

Status changed to: We like it! (in the queue)

@hogi - We have reviewed your request and think it will be a great addition to JMP. This request is in the queue of items to work on in a future release.

hogi
Level XII

: )

Craige_Hales
Super User

An example of a painted corner: this should have produced an error from day 1:

[1 2 3,4 5 6][-2]
hogi
Level XII

@Sarah-Sylvestre , could you please add to the wish:

- return "." if the vector has less entries than the index

[1 2 3][4] = .

 

At the moment, JMP throws an error and stops:

hogi_0-1719698078113.png

 

The error message is quite misleading. 
Why does it say invalid subscript (must be number ...)

4 IS a number, right?

 

@hogi Thanks for bringing this one to our attention!  We have fielded this in Technical Support (in lieu of a Wishlist Item).  In any case, your feedback is greatly appreciated. 

copying @Sarah-Sylvestre 

hogi
Level XII

I hope, other users like it as well - such that it gets implemented in a future release.
Let's see ...