One command to extract all the data

2 vues (au cours des 30 derniers jours)
Mac
Mac le 22 Déc 2021
Commenté : Mac le 23 Déc 2021
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);

Réponse acceptée

DGM
DGM le 22 Déc 2021
Modifié(e) : DGM le 22 Déc 2021
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 commentaire
Mac
Mac le 23 Déc 2021
Wow. That's amazing. Thank you very DGM. Appreciate it a lot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by