error reading excel

7 ビュー (過去 30 日間)
kash
kash 2012 年 2 月 14 日
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

採用された回答

Ken Atwell
Ken Atwell 2012 年 2 月 14 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by