フィルターのクリア

How to import blanks cells as Nans

10 ビュー (過去 30 日間)
Cristina
Cristina 2015 年 4 月 27 日
コメント済み: Ahmed Nirjhar Alam 2020 年 7 月 23 日
I have a file (created in excel) with >100k rows and 22 columns. Many of the cells are blanks (not zeros). If I use csvread to import the data Matlab changes the banks to zeros. I cannot first change the blanks to 99999 because excel crashes. Is there a way to make Matlab import the blanks as Nan's?

採用された回答

Mohammad Abouali
Mohammad Abouali 2015 年 4 月 27 日
a=importdata('sampledata.csv')
a =
1 2 3 4 5
1 2 3 NaN 5
1 NaN 3 4 5
1 2 3 NaN 5
1 2 3 4 5
1 2 3 4 NaN
  3 件のコメント
Mohammad Abouali
Mohammad Abouali 2015 年 4 月 28 日
you are welcome
Ahmed Nirjhar Alam
Ahmed Nirjhar Alam 2020 年 7 月 23 日
Is there any equivalent substitute for when I have a file with multiple datatypes(such as integers, doubles, strings) in different columns?

サインインしてコメントする。

その他の回答 (1 件)

Stephen23
Stephen23 2015 年 4 月 28 日
編集済み: Stephen23 2015 年 4 月 28 日
Here is a list of some functions that can import blank/missing data as NaN:
and you can find comprehensive lists of all file reading functions in the documentation:
  1 件のコメント
Cristina
Cristina 2015 年 4 月 28 日
thank you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStandard File Formats についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by