Selecting multiple different rows in a 3D matrix

I have a 3D matrix.
30x17x456
I'd like to select all 1st and 2nd dimention but only perticular rows in 3rd dimention.... for example
x = matrix(:,:,2:16:24:48);
This doesnt work, would i have to select each row out the matrix indavidually?

回答 (1 件)

James Tursa
James Tursa 2021 年 12 月 6 日

1 投票

You can use a vector for the indexing. E.g.,
x = matrix(:,:,[2:16,24:48]);
Does that, or something like that, do what you want?

2 件のコメント

Tom Sagar
Tom Sagar 2021 年 12 月 6 日
sorry I realised after i posted the code is wrong, im not trying to find rows 2 to 16.
I need rows:
4,16,28,40,52,64,76
Does that make sense
Cheers
James Tursa
James Tursa 2021 年 12 月 6 日
This?
x = matrix(:,:,4:12:76);

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

質問済み:

2021 年 12 月 6 日

コメント済み:

2021 年 12 月 6 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by