フィルターのクリア

How can I find index from a 3D matrix?

2 ビュー (過去 30 日間)
Ashfaq Ahmed
Ashfaq Ahmed 2023 年 2 月 21 日
コメント済み: Ashfaq Ahmed 2023 年 2 月 21 日
Hi, I have a matrix M that is of this size: M = 376x268x764 double.
Here, 376x268 are latitude longitude grid cells and 764 is the day counts.
Now, from that 764 days, I want to precicely select these 16 days -
d = [1, 3, 45, 56, 111, 121, 135, 440, 489, 491, 511, 555, 569, 599, 608, 700];
in a way that, I still have a 3D matrix but the new size is 376x268x16
Can anyone please help me doing this?

採用された回答

Matt J
Matt J 2023 年 2 月 21 日
編集済み: Matt J 2023 年 2 月 21 日
M=rand(376,268,764);
d = [1, 3, 45, 56, 111, 121, 135, 440, 489, 491, 511, 555, 569, 599, 608, 700];
Md=M(:,:,d);
whos M Md
Name Size Bytes Class Attributes M 376x268x764 615894016 double Md 376x268x16 12898304 double
  2 件のコメント
Ashfaq Ahmed
Ashfaq Ahmed 2023 年 2 月 21 日
Hi @Matt J, thanks! Yes, that was exactly what I wanted. Can you please tell me how can I average the values for the lat/lon grid for all these 16 arrays so that I have the Averaged_Md of size 376x268x1?
Ashfaq Ahmed
Ashfaq Ahmed 2023 年 2 月 21 日
Got it, I guess it should be mean(Md,3)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by