Undefined function or variable.

clear; clc;
m_proj('Miller','lat',[0 14],'lon',[95 126]);
% Generate a smaller coastline for faster plot
m_gshhs_f('save','RTKNET');
dir = 'C:\Users\ACER\Documents\1-DOKUMEN\5-DOKUMEN MAT NIZAM\PSM\all\5-RESEARCH INFORMATION\RADS\m_map';
file = 'Wave_climatology(SW).asc';
%out = 'M2_aaaa.xlsx';
name = 'Significant Wave Height Climatology over Malaysian Seas during Southwest Monsoon from 1993 to 2016 (May-August) ';
cd(dir)
Data = textread(file);
lat = Data(:,1);
lon = Data(:,2);
geoid = Data(:,3); % unit 3 (m) 5 (cm)
% Specifying map projection
figure;
m_proj('Miller','lat',[0 14],'lon',[95 126]);
% Contour & colour settings
dx =95:0.25:126; % set the min,max latitude and interval
dy = 0:0.25:14+1; % set the min,max longitude and interval
[Xi,Yi] = meshgrid(dx,dy);
[Zi] = surfergriddata(lon,lat,geoid,Xi,Yi);
% datata = [Zi];
% xlswrite(out, datata);
% %xlswrite(latname, Yi);
% %xlswrite(longname, Xi);
m_pcolor(Xi,Yi,Zi)
shading interp;
colormap jet;
% Coastline & grid
m_gshhs_f('patch',[1 1 1]);
m_gshhs_f('color','k');
m_usercoast('RTKNET','color','k');
m_grid('linestyle','none','box','fancy','tickdir','in');
% Labels & colorbar
title(name,'FontWeight','bold','FontSize',12);
xlabel('Longitude','FontWeight','bold','FontSize',12);
ylabel('Latitude','FontWeight','bold','FontSize',12);
%[X,Y]=m_xy2ll(lon,lat);
%m_line(lon,lat,'linewi',4,'color','r');
%m_line(amp1,lon1,'linewi',4,'color','b');
% caxis([28.28,30.97])
%cb = colorbar('h');
%set(get(cb,'xlabel'),'String','Amplitude (m)','FontWeight','bold');
set(get(colorbar,'ylabel'),'String','Significant Wave Height (m)','FontWeight','bold')
Error:
Undefined function or variable 'Zi'.
Error in mapping1 (line 46)
[Zi] = surfergriddata(lon,lat,geoid,Xi,Yi);

1 Comment

"surfergriddata" has 6 input arguments, not 5.

Sign in to comment.

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 23 Jul 2019
Edited: KALYAN ACHARJYA on 23 Jul 2019
If you are using this file exchange custom function, you have to pass SIX inputs to the function, not FIVE

Asked:

zzm
on 23 Jul 2019

Edited:

on 23 Jul 2019

Community Treasure Hunt

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

Start Hunting!