Problem with fopen - not a valid target for assignment
Mostrar comentarios más antiguos
I am using fopen to try to read multiple files, but it fails to open the second file. My error reads "The expression to the left of the equals sign is not a valid target for assignment" at the second fid = fopen statement. I have tried changing the variable name to no avail. I am not sure what I can do to fix this, please help!
fid = fopen('padlockposition.txt');
position = zeros(1000,3);
for i = 1:1000
line = fgetl(fid);
position(i,1) = str2double(line(1:7));
position(i,2) = str2double(line(9:16));
if numel(line) == 26
position(i,3) = 0;
elseif numel(line) == 29
position(i,3) = str2double(line(25:29));
else
position(i,3) = position(i-1,3);
end
end
figure(1)
plot(position(:,1)-226.2,position(:,2),position(:,1)-226.2,position(:,3))
axis([0 2.5 100 -900
fclose(fid);
fid = fopen('padlockpid.txt');
pid = zeros(1000,2);
(the program will continue from here once I figure out this problem)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Low-Level File I/O en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!