Rust ndarray: how shall I extract one dimension `s![]` from a two dimension `s![]`

I have create a two dimension slice as below:
let x = s![.., 3..6];
then I want to create 'y' by 'x' and y's value is s![3..6];
How shall I do this?

Can you explain what you mean by "create 'y' by 'x'"? Do you mean transpose the array?

I want to generate another s![ ] from 'x' and its values is 's![3..6]`

If you want to get a one-dimensional array out of 'x', you need to specify the row.

You could do something like:

let x = s![.., 3..6];
let new_array = original_array.slice(x);
let x = s![ROW_NUM, 3..6];
let new_array2 = original_array.slice(x);

That would get you a one-dimensional array with 3 elements

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.