Error creating matlab pcolor
Afficher commentaires plus anciens
I am running into an error plotting temperature form my file (it contains data from Jan-March)
close all, clear all clc
% note I've renamed the files, call them what you like but they need to
% have the year in them to load in a loop
fp = 'C:\Users\Madison-Riley\Desktop\Thesis\Environmental_Data\Temperature';
ncdisp(fullfile(fp,'Temp_Q1(2020).nc'))
%look at one file to interrogate and understand dimensions and variables
% test=ncread([filepath,'June2021.nc'],'uo'); whos test
time = ncread(fullfile(fp,'Temp_Q1(2020).nc'),'time'); whos time
ntime=length(time);
lon=ncread(fullfile(fp,'Temp_Q1(2020).nc'),'longitude');
lat=ncread(fullfile(fp,'Temp_Q1(2020).nc'),'latitude');
[LON,LAT]=meshgrid(lon,lat);
bottomT=ncread(fullfile(fp,'Temp_Q1(2020).nc'),'bottomT'); whos utide
% dimensions lon*lat*depth*time
% https://uk.mathworks.com/help/matlab/ref/ncread.html
% try different depth layers here, why is the land extent so different?
bottomTtest=ncread(fullfile(fp,'Temp_Q1(2020).nc'),'bottomT',[1 1 1],[length(lon) length(lat) 1 1]);
close all
pcolor(LON,LAT,bottomT.'), shading flat, colorbar
I get the following Error:
Error using internal.matlab.imagesci.nc/read
COUNT has incorrect number of elements (4). The variable has 3 dimensions.
Error in ncread (line 76)
vardata = ncObj.read(varName, varargin{:});
Error in Temp_Q1_20 (line 22)
bottomTtest=ncread(fullfile(fp,'Temp_Q1(2020).nc'),'bottomT',[1 1 1],[length(lon) length(lat) 1 1]);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Downloads dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!