What should I do if I get an error message called "Execution of script addpoints as a function is not supported"?

17 views (last 30 days)
Error code message is
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Warning: No video frames were written to this file. The file may be invalid.
> In VideoWriter/close (line 282)
In VideoWriter/delete (line 217)
In DIP_20161130 (line 117)
Execution of script addpoints as a function is not supported:
K:\Program Files\MATLAB\R2022a\toolbox\matlab\graphics\addpoints.m
Error in draw_animation6 (line 7)
addpoints(p,[0 0+sin(th1)],[0 0+cos(th1)]);
Error in DIP_20161130 (line 125)
draw_animation6(th1(i),th2(i));
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
And The code for this error line is
function draw_animation6(th1,th2)
global p p1
% Addpoints
addpoints(p,[0 0+sin(th1)],[0 0+cos(th1)]); %% -------LINE 7----------
addpoints(p1,[0+sin(th1) 0+sin(th1)+sin(th2)],[0+cos(th1) 0+cos(th1)+cos(th2)]);
%hold on
drawnow
%hold on
pause(0.01);
end
I don't know what this error message means or what to do.
I'd really appreciate it if you could help me. !!!

Answers (1)

Walter Roberson
Walter Roberson on 8 May 2022
Inside of your function, your global variable p is not class AnimatedLine
The most common cause would be that in the place you created the animated line and assigned to p, that you did not declare p as a global variable.

Categories

Find more on Animation 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!