Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays.
Show older comments
The data is from Copernicus, but sea surface height (SHW) is a 3D matirx
clear
clc
dir = 'C:\Users\Madison-Riley\Downloads\';
ncfile = 'PotentialTemp.nc'; % name of data file from copernicus
ncdisp([dir,ncfile])
lon = ncread([dir,ncfile], 'longitude');
lat = ncread([dir,ncfile], 'latitude');
depth = ncread([dir,ncfile], 'depth');
time = ncread([dir,ncfile], 'time');
% note 'squeeze' function gets rid of the single dimension (depth=1):
temp= squeeze(ncread([dir,ncfile], 'thetao')); % Sea water potential temperature (long,lat,depth(=1),time)
clf
% plot temp for time t=1:
pcolor(lon,lat,temp(:,:,1)');
shading flat;
colorbar
2 Comments
Cris LaPierre
on 3 Jun 2023
I don't see a variable SHW in your code. The only transpose operation I see is a 2D array, which should work.
Please share the full error message (all the red text). Please save your variable lon, lat, depth, time, and temp to a mat file and attach that to your post using the paperclip icon.
Madison
on 3 Jun 2023
Accepted Answer
More Answers (1)
I could reproduce the same error message as follows:
X = rand(3,3,4)
transpose(X)
The best bet is replace this with pagetranspose as it says:
pagetranspose(X)
3 Comments
Madison
on 3 Jun 2023
Cris LaPierre
on 3 Jun 2023
Edited: Cris LaPierre
on 3 Jun 2023
Please share the full error message (all the red text). Please save your variables lon, lat, time, and SHW to a mat file and attach that to your post using the paperclip icon.
Madison
on 3 Jun 2023
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!