but I get an error
"error: Invalid call to rgb2ind. Correct usage is:
-- [X, MAP] = rgb2ind (RGB)
-- [X, MAP] = rgb2ind (R, G, B)
Additional help for built-in functions and operators is
available in the online version of the manual. Use the command
'doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at
https://www.octave.org and via the
address@hiddenmailing list."
The code is below. Are there any workarounds?
h = figure;
axis tight manual % this ensures that getframe() returns a consistent size
filename = 'testAnimated.gif';
for n = 1:0.5:5
% Draw plot for y = x.^n
x = 0:0.01:1;
y = x.^n;
plot(x,y)
drawnow
% Capture the plot as an image
frame = getframe(h);
im = frame2im(frame);
[imind,cm] = rgb2ind(im,256);
% Write to the GIF File
if n == 1
imwrite(imind,cm,filename,'gif', 'Loopcount',inf);
else
imwrite(imind,cm,filename,'gif','WriteMode','append');
end
end
Ps I tried with
----------------------------------------------------------------------
GNU Octave Version: 4.4.0 (hg id: d703d8bbc6ae)
GNU Octave License: GNU General Public License
Operating System: Linux 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64
----------------------------------------------------------------------
Package Name | Version | Installation directory
--------------+---------+-----------------------
control | 3.1.0 | /home/rt/octave/control-3.1.0
signal | 1.4.0 | /home/rt/octave/signal-1.4.0
>>
--