Info

This question is closed. Reopen it to edit or answer.

Good day guys, I have wrote a code to read multiple files and plot a graph from the information in the files in a folder but I am getting errors whilst trying to read the code. I have attached the code below and the errors which I get.

1 view (last 30 days)
D = dir('C:/Users/NSebopetse/Pictures/nakampe-optiplex-760/san_2018-11*');
N = length(D);
for i = 1 : N
if ~strcmp(D(i).name(1),'.')
fn = fullfile(D(i).folder,D(i).name);
fileID = fopen(D(i).name, 'rt');
C =textscan(fileID(i), '%q %q','Delimiter',':, ');
end
end
fclose(fileID);
xx=C{3};
yy=C{1};
x = xx(2:25556);
y = yy(2:25556);
X = str2num( cell2mat(x) );
Y = str2num( cell2mat(y) );
figure(5)
plot(X,Y);
ERROR MESSAGE:
Index exceeds the number of array elements (1).
Error in scanall (line 7)
C =textscan(fileID(i), '%q %q','Delimiter',':, ');

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!