이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Attempt to execute SCRIPT scatter as a function: F:\MATLAB\R2019a\toolbox\m
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello all,
I keep getting this error message below
Attempt to execute SCRIPT scatter as a function:
F:\MATLAB\R2019a\toolbox\matlab\specgraph\scatter.m
Note: I have checked the "specgraph" folder and delete the "scatter.m" file, but i keep getting the above error message.
Please is there any other means to handle this issue? Thank you
채택된 답변
Cris LaPierre
2022년 1월 22일
댓글 수: 14
Cris LaPierre
2022년 1월 22일
This file F:\MATLAB\R2019a\toolbox\matlab\specgraph\scatter.m is MATLAB's function for creating scatter plots. It should be a function, not a script, and you probably shouldn't be modifying it.
Please share the complete error message (all the red text)
CHARLES ADDEY
2022년 1월 22일
편집: Cris LaPierre
2022년 1월 22일
I was trying to do this when i got the error
% dummy data
n = 50;
x = linspace(112,120,n)+0.25*rand(1,n); % Longitude
y = linspace(22,24,n)+0.5*rand(1,n); % Latitude
z = 10+y; % temperature
figure(1),
scatter(x,y,z,z,'filled');
colormap('jet');
colorbar('vert');
The error from the red text is the four lines below
Attempt to execute SCRIPT scatter as a function:
F:\MATLAB\R2019a\toolbox\matlab\specgraph\scatter.m
Error in Gridd_and_average (line 11)
scatter(x,y,z,z,'filled');
Cris LaPierre
2022년 1월 22일
Pleaes run the script. If you still get the error, share the result of the following code.
pwd
which scatter -all
type scatter.m
CHARLES ADDEY
2022년 1월 23일
Here is the result
>> pwd
which scatter -all
type scatter.m
ans =
'C:\Users\hp\Desktop\DESKTOP DOCUMENTS\INTERPOLATION AND GRIDDING(MATLAB)\interp'
F:\MATLAB\R2019a\toolbox\coder\half\@half\scatter.p % half method
function varargout =scatter(varargin)
%SCATTER Create scatter or bubble plot
% Refer to the MATLAB SCATTER reference page for more information.
%
% See also SCATTER
% Thomas A. Bryan, 2 November 2004
% Copyright 1999-2012 The MathWorks, Inc.
c = todoublecell(varargin{:});
[varargout{1:nargout}] = feval(mfilename,c{:});
>>
Cris LaPierre
2022년 1월 23일
Have you recovered the file you deleted?
- F:\MATLAB\R2019a\toolbox\matlab\specgraph\scatter.m
CHARLES ADDEY
2022년 1월 25일
Yes, I have recovered it, i still get the error message
Undefined function 'scatter' for input arguments of type 'double'.
Error in Gridd_and_average (line 11)
scatter(x,y,z,z,'filled');
Cris LaPierre
2022년 1월 25일
편집: Cris LaPierre
2022년 1월 29일
Somewhere you have a script named scatter.m that is being called instead of the plotting function scatter. Perhaps the script you are working in? If so, try renaming your script.
If the file is restored, repeat the last 2 commands above and share the result.
CHARLES ADDEY
2022년 1월 29일
Hi Chris, the result of the last command is shared below.
ERROR MESSAGE
>> Undefined function 'throwIfGraphics' for input arguments of type 'string'.
Error in scatter (line 31)
throwIfGraphics(x, "Line");
Error in Gridd_and_average (line 11)
scatter(x,y,z,z, 'filled');
RESULT OF LAST 2 COMMANDS
>> pwd
which scatter -all
type scatter.m
ans =
'C:\Users\hp\Desktop\DESKTOP DOCUMENTS\INTERPOLATION AND GRIDDING(MATLAB)\interp'
F:\MATLAB\R2019a\toolbox\matlab\specgraph\scatter.m
F:\MATLAB\R2019a\toolbox\coder\half\@half\scatter.p % half method
function h = scatter(varargin)
%SCATTER Scatter plot.
% Supported syntaxes for tall X, Y:
% SCATTER(X,Y)
% SCATTER(X,Y,S)
% SCATTER(X,Y,S,C)
% SCATTER(...,M)
% SCATTER(...,'filled')
% SCATTER(AX,...)
%
% Notes and Limitations:
% 1) S must be scalar or empty
% 2) C must be scalar or RGB triplet
% 3) Categorical inputs are not supported.
% 4) With tall inputs, SCATTER plots in iterations, progressively
% adding to the plot as more data is read. During updating, a progress
% indicator shows the proportion of data that has been plotted. Zooming
% and panning is supported during updating before the plot is complete.
% To pause the update process, press the pause button in the progress
% indicator.
%
% See also SCATTER, BINSCATTER, TALL, TALL/PLOT.
% Copyright 2017-2018 MathWorks, Inc.
[cax,args] = axescheck(varargin{:});
narginchk(2,inf);
x = args{1};
y = args{2};
args(1:2) = [];
throwIfGraphics(x, "Line");
% error checking in the first two inputs
tall.checkIsTall(mfilename, 1, x);
x = tall.validateType(x,mfilename,{'numeric','logical','datetime','duration'},1);
x = lazyValidate(x, {@(x1)iscolumn(x1) && (~isnumeric(x1) || isreal(x1)), ...
'MATLAB:scatter:InvalidTallData'});
tall.checkIsTall(mfilename, 2, y);
y = tall.validateType(y,mfilename,{'numeric','logical','datetime','duration'},2);
y = lazyValidate(y, {@(y1)iscolumn(y1) && (~isnumeric(y1) || isreal(y1)), ...
'MATLAB:scatter:InvalidTallData'});
[x, y] = validateSameTallSize(x,y);
% error checking for the rest of the inputs
[args, appendautofacecolor] = parseinput(args);
cax = newplot(cax);
xclass = tall.getClass(x);
yclass = tall.getClass(y);
switch xclass
case 'datetime'
xtype = datetime;
case 'duration'
xtype = duration;
otherwise % numeric, logical
xtype = 1;
end
switch yclass
case 'datetime'
ytype = datetime;
case 'duration'
ytype = duration;
otherwise % numeric, logical
ytype = 1;
end
matlab.graphics.internal.configureAxes(cax,xtype,ytype);
[~,autocolor] = matlab.graphics.chart.internal.nextstyle(cax,true,false,false);
args = [{'CData',autocolor} args];
if appendautofacecolor
args = [args {'MarkerFaceColor','flat'}];
end
t = table(x, y);
markforreuse(t);
x = subsref(t, substruct('.','x'));
y = subsref(t, substruct('.','y'));
htemp = matlab.graphics.chart.primitive.tall.Scatter('XData', x, 'YData', y, ...
args{:}, 'Parent', cax);
if nargout > 0
h = htemp;
end
function [outargs,appendautofacecolor] = parseinput(args)
tall.checkNotTall(mfilename, 2, args{:});
outargs = {};
customcolor = false;
nameoffset = 2;
ind = 1; % parsing index
if ~isempty(args) && ~isNonTallScalarString(args{ind})
% size input
s = args{ind};
if ~isempty(s)
validateattributes(s, {'numeric'}, {'scalar', 'real', 'positive', 'finite'},...
mfilename, 'Size');
outargs = {'SizeData', s};
end
ind = ind + 1;
% color input
if ind <= length(args)
if isnumeric(args{ind})
c = args{ind};
validateattributes(c,{'numeric'},{'size',[1 3],'nonnegative',...
'real', '<=', 1}, mfilename, 'Marker Color');
customcolor = true;
else
[~,c,~,tmsg] = colstyle(args{ind});
customcolor = isempty(tmsg) && ~isempty(c);
end
if customcolor
outargs = [outargs {'MarkerEdgeColor',c}];
ind = ind + 1;
end
end
end
% filled option and marker style
appendautofacecolor = false;
if ind <= length(args)
% filled option
filled = false;
if strncmpi(args{ind}, 'filled', length(args{ind}))
filled = true;
ind = ind + 1;
end
% marker style
if ind <= length(args)
[~,~,m,tmsg] = colstyle(args{ind});
if isempty(tmsg) && ~isempty(m)
outargs = [outargs {'Marker',m}];
ind = ind + 1;
end
% filled option again, such that marker style and filled are order
% independent
if ind <= length(args) && ~filled && strncmpi(args{ind}, 'filled', length(args{ind}))
filled = true;
ind = ind + 1;
end
end
if filled
if customcolor
outargs = [outargs {'MarkerFaceColor',c}];
else
appendautofacecolor = true;
end
end
end
% remaining must be name-value pairs
if rem(length(args)-ind+1,2) ~= 0
error(message('MATLAB:scatter:ArgNameValueMismatch'));
end
names = setdiff(properties('matlab.graphics.chart.primitive.tall.Scatter'),...
{'Annotation', 'BeingDeleted', 'Children', 'Type'});
while ind <= length(args)
% perform partial matching and completion
paramname = validatestring(args{ind},names,nameoffset+ind);
outargs = [outargs paramname args(ind+1)]; %#ok<AGROW>
ind = ind + 2;
end
Image Analyst
2022년 1월 29일
What is z?
whos z
Why are you passing in z into scatter() twice?
scatter(x,y,z,z, 'filled');
Cris LaPierre
2022년 1월 29일
What version of MATLAB are you using? Your error message suggests R2019a, but if so, that is not the 2019a version of scatter.m.
CHARLES ADDEY
2022년 1월 31일
I am using R2019a, probably i might have mixed up the scatter.m somewhere along the line while trying to resolve this issue.
Is there a way to reset the R2019a to the default installation state, or I should just uninstall and reinstall back. Thank you Cris
Cris LaPierre
2022년 1월 31일
편집: Cris LaPierre
2022년 1월 31일
I'd suggest uninstalling and reinstalling. It may be possible to work out another way, but it would take much longer to work out via comments here.
Typically this error message happens when you save your script using the same name as MATLAB's function name. However, the tests above show that doesn't appear to be the case. Just thought it was worth pointing out so that you can be sure to avoid using those names going forward.
Walter Roberson
2022년 2월 1일
scatter(x,y,z,z, 'filled');
is valid. It would use z as the spot size and also as the color indication.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)