필터 지우기
필터 지우기

After smoothly running this script all day yesterday, the command imagescnan stopped working. Also, note that the data files downloaded from NASA come as '.nc4.nc4'

조회 수: 3 (최근 30일)
%My script:
P = ('/Users/USERNAME/Desktop/MERRA2_DATA/PrecipM2Data/MERRA2_100.tavgM_2d_lnd_Nx.198001.nc4.nc4');
lon = ncread(P, 'lon');
Error using internal.matlab.imagesci.nc/openToRead
Could not open /Users/USERNAME/Desktop/MERRA2_DATA/PrecipM2Data/MERRA2_100.tavgM_2d_lnd_Nx.198001.nc4.nc4 for reading.

Error in internal.matlab.imagesci.nc (line 124)
this.openToRead();

Error in ncread (line 69)
ncObj = internal.matlab.imagesci.nc(ncFile);
ncdisp(P, 'lon');
lat = flipud(ncread(P, 'lat'));
PPT = rot90(ncread(P, 'PRECTOTLAND'));
imagescnan (lon, lat, PPT)
set (gca, 'ydir', 'normal')
xlim([-180 180])
ylim ([-90 90])
title('1980 January')
colorbar
% Then I get the error:
Unrecognized function or variable 'imagescnan'.
Error in PrecipMERRA2_July (line 23)
imagescnan (lon, lat, PPT)
%It works with imagesc, just not imagescnan...

답변 (1개)

Infinite_king
Infinite_king 2023년 9월 27일
편집: Infinite_king 2023년 9월 27일
Hi,
I understand that you are trying to use the ‘imagescnan’ function to read the data file, and it has been giving an error since the second day.
Possibly, the error might be occurring because the 'imagescnan' function is not on the MATLAB search path. The 'imagescnan' function is not a built-in function of MATLAB. Before using custom function files, you need to add their paths to the MATLAB search path. To fix the problem try placing ‘imagescnan.m’ file in the same folder as the main script file.
For more information on ‘imagescnan’ function and ‘MATLAB search path’ refer the following resources
  1. https://www.mathworks.com/help/matlab/matlab_env/files-and-folders-that-matlab-accesses.html
  2. https://www.mathworks.com/matlabcentral/fileexchange/20516-imagescnan-m-v2-1-aug-2009
Hope this is helpful.

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by