error reading excel

8 visualizaciones (últimos 30 días)
kash
kash el 14 de Feb. de 2012
I displayed data after using xlsread
raw =
Columns 1 through 5
[39] ' State-gov' [ 77516] ' Bachelors' [13]
[50] ' Self-emp-not-inc' [ 83311] ' Bachelors' [13]
[38] ' Private' [215646] ' HS-grad' [ 9]
[53] ' Private' [234721] ' 11th' [ 7]
[28] ' Private' [338409] ' Bachelors' [13]
[37] ' Private' [284582] ' Masters' [14]
[49] ' Private' [160187] ' 9th' [ 5]
I performed an operation
txt=strrep(txt,'Self-emp-not-inc','0.13');
i did same for private,State-gov,Bachelor,etc
Val = str2double(txt)
i get those values corect but other column 1,3,5 are displayed as NAN
PLEASE HELP ,after performing these operation i dont need nan ,i need only actual column 1,3,5 to be displayed as it is

Respuesta aceptada

Ken Atwell
Ken Atwell el 14 de Feb. de 2012
xlsread returns (up to) three values, and it appears you are capturing all three:
  • numeric results (only)
  • text results (only)
  • raw -- numeric and text results (mixed)
Make sure you're performing your post-processing operations on the right result. I'm guessing that "str2double(txt)" is not working for you because you're doing that operation on the text-only results (the second argument). You would want to call str2double on the third output. Or, it is likely the first output already captures what you are interested in.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by