Array indices must be positive integers or logical values.
Show older comments
Hi,
I am getting the error using the code given below, can anyone help me please. I have negative values in the graph as well I think that is why it happening but I do not know how to resolve this problem.
Code:
close all; clear all; clc;
a=readmatrix('perf_7.ods');
x=a(:,10);
y=a(:,4);
for k=1:length(x)
plot(x(k),y(k),'x','LineWidth',0.5);
hold on
plot(x(1:k),y(1:k),'x','LineWidth',0.5);
drawnow
xlim([0 6])
ylim([0 0.8])
F(i)= getframe(gcf);
pause(0.1)
end
video = VideoWriter ('Graph.avi','Uncompressed AVI')
open(video)
writeVideo(video,F);
close(video)
Error:
Array indices must be positive integers or logical values.
Error in Graph_ani1 (line 16)
F(i)= getframe(gcf);
1 Comment
Weixin Wang
on 20 Apr 2021
You index variable seems to be 'k', not 'i'.
Accepted Answer
More Answers (0)
Categories
Find more on Image Preview and Device Configuration 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!