Importing Data From Excel

12 visualizaciones (últimos 30 días)
Greg
Greg el 5 de Jul. de 2011
Hi
When importing data from Excel using xlsread() regadless if the data is numeric or char in the Excel file once loaded into Matlab its always treated as a char. I've used isnumeric() to test data type and this always fails to spot the data as a number.
The same code works with other files so suspec its the file but in Excel the formats are saved as General( as per the working files).
Plaese help Greg

Respuestas (2)

Sean de Wolski
Sean de Wolski el 5 de Jul. de 2011
Is the data a char in the excel file?
You could always brute force it:
is_str_a_num = str2double(char_num); %is it a number?
if ~isnan(is_str_a_num); %?
num = is_str_a_num; %it is! woohoo
else
something_else; %it isn't
end

Greg
Greg el 15 de Jul. de 2011
Thanks for the response.
In the end i swithced to loading the data using the datset() function. It seemed to take care of all the types for me

Categorías

Más información sobre Data Import from MATLAB 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!

Translated by