Problem using xlsread!! Unable to read XLS file - File is not in recognized format
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael
el 2 de Feb. de 2015
Comentada: Stephen23
el 6 de Feb. de 2015
Hello,
I have inherited a script from someone which loads in an excel spread sheet in the format csv. However, I am stuck as it complains 'Unable to read XLS file /filelocation/ File is not in recognized format'.
Does anyone know what the problem is??
Here is my script:
%%OPENING SUMMARY FILE
% Uses 'parse_vindta.m'
% This produces a structure 'data', which includes fields of all
% columns of the summary file
%d = parse_VINDTA_RaTS([data_dir filesep instrument filesep instrument 'Summary.csv']);
d = parse_VINDTA(['/correctfilelocation/LucySummary.csv']);
using the function parse_VINDTA.m:
function d = parse_VINDTA(sum)
% called from VINDTA_start.m
% reads VINDTA summary files into a matlab data structure for DIC and TA
% calculations
% OJL October 2013
disp('Parsing data structure and matching profile data to carbon samples...')
global cloud_dir
[summary,text] = xlsread(sum);
It gets to this line and then shows the error message...
I am using MATLAB 2012b using a remote login to a linux server.
Any ideas?
I have tried other ideas that are on the net but with no luck..
thanks in advance, Michael
0 comentarios
Respuesta aceptada
Stephen23
el 2 de Feb. de 2015
Editada: Stephen23
el 2 de Feb. de 2015
Read the xlsread documentation: On Windows® systems with Microsoft Excel software, xlsread reads any file format recognized by your version of Excel. If your system does not have Excel for Windows, xlsread operates in basic import mode, and reads only XLS, XLSX, XLSM, XLTX, and XLTM files. You write that you are using a Linux server, and the documentation does not list CSV as being a supported format for Linux systems.
Also note that it is better to use fullfile to generate filepaths, rather than by string concatenation: [data_dir filesep instrument filesep...].
In any case there is a much more important question for you: why use xlsread to read a CSV file anyway? Why not use one of the CSV-reading tools, such as csvread ? This would resolve this issue completely.
Important: You need to change the variable name sum, which is used as the input argument to the function parse_VINDTA. sum is an inbuilt function in MATLAB, so shadowing its names is a really bad idea. For the same reason avoid variables names i, j, length, prod, etc.
2 comentarios
Stephen23
el 6 de Feb. de 2015
I replied to your new question with drop-in replacement code you can try.
If my response above has answered your original question, then please Accept this answer.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!