problem in using textscan to import data from csv

5 Ansichten (letzte 30 Tage)
kdilhara
kdilhara am 11 Dez. 2015
Beantwortet: dpb am 11 Dez. 2015
I need to import a csv file with 60 columns. All have numerical values. However, some values are missing and instead of keeping it as 0 or Nan, those columns have "*****" and when importing using textscan it gives an error.
So how can I replace those string parts (******) with NaN and import it as numbers.
so finally my requirement is to import the csv file to number arrays with replacing "*****"with NaN
  1 Kommentar
Walter Roberson
Walter Roberson am 11 Dez. 2015
Could you give a couple of sample lines? And also please show your current textscan attempt.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

dpb
dpb am 11 Dez. 2015
Filling a field with asterisks is Fortran convention if output magnitude exceeds available width for a field; possibly can you rework the application building the output file to correct such?
Failing that, use the 'TreatAsEmpty','******' option to cause textscan to return those fields as missing values.

Community Treasure Hunt

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

Start Hunting!

Translated by