One command to extract all the data

2 ビュー (過去 30 日間)
Mac
Mac 2021 年 12 月 22 日
コメント済み: Mac 2021 年 12 月 23 日
I have data that looks like the image above. Could anyone please help me what command to use to extract all the data? I did it manually using the code below. But, I have another data that is up to val(:,:,365), so any help is greatly appreciated.
sla=ncread('cmems_obs-sl_glo_phy-ssh_my_allsat-l4-duacs-0.25deg_P1M-m_1639987960602.nc','sla');
A1=sla(:,:,1)';
A2=sla(:,:,2)';
A3=sla(:,:,3)';
A4=sla(:,:,4)';
A5=sla(:,:,5)';
A6=sla(:,:,6)';
A7=sla(:,:,7)';
A8=sla(:,:,8)';
A9=sla(:,:,9)';
A10=sla(:,:,10)';
A11=sla(:,:,11)';
A12=sla(:,:,12)';
slaData=vertcat(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12);

採用された回答

DGM
DGM 2021 年 12 月 22 日
編集済み: DGM 2021 年 12 月 22 日
Just permute the array dimensions.
sla = cat(3,(1:10).',(11:20).',(21:30).',(31:40).'); % smaller example array
size(sla) % 4 columns arranged on dim3
ans = 1×3
10 1 4
% permute
sla = permute(sla,[3 1 2])
sla = 4×10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
  1 件のコメント
Mac
Mac 2021 年 12 月 23 日
Wow. That's amazing. Thank you very DGM. Appreciate it a lot.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by