Actually, that was just a highlighting issue. I have both files, one with a y, one without, and it only sees the one without. Updated to show this clearly. Note it also see the version with - Copy in it so it's not a length issue.
Matlab doesn't see a file
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am in the same directory, it collects it in a dir, but exist shows 0 and I can't open it.
2 comentarios
Respuestas (4)
Walter Roberson
el 11 de Jun. de 2015
There could be non-printing characters in the name.
dinfo = dir('*.xlsx');
for K = 1 : length(dinfo)
thisfile = dinfo(K).name;
disp(thisfile); %as string
disp(thisfile + 0); %as bytes
r = exist(thisfile);
if r > 0
fprintf('File exists, type %d\n', r);
else
fprintf('File does not exist??\n');
end
end
0 comentarios
Joseph Cheng
el 10 de Jun. de 2015
Editada: Joseph Cheng
el 10 de Jun. de 2015
Thats because the file doesn't have a y at the end. Clearly the file shown using dir is
TEMPOgratingEfficienc.xlsx
and your exist is looking for TEMPOgratingEfficiency.xlsx
2 comentarios
Joseph Cheng
el 10 de Jun. de 2015
I'd say update the picture to show both. I see the file now as it partially cut of under the TEMPOgratingEfficiency - Copy.xlsx. Are you able to put the full path such as
exist('c:\temporary\thefileimlookingat.xls')
Kelly Kearney
el 10 de Jun. de 2015
In your exist call, you refer to the file as TEMPOgratingEfficiency.xlsx, while the dir list shows TEMPOgratingEfficienc.xlsx. Note the missing y in the latter.
Image Analyst
el 11 de Jun. de 2015
Like the editor recommends, try using the 'file' option in exist(). And like Joseph said, update your screenshot. And attach the "invisible" file so we can check it on our computers.
0 comentarios
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!