problem in using textscan to import data from csv

조회 수: 5 (최근 30일)
kdilhara
kdilhara 2015년 12월 11일
답변: dpb 2015년 12월 11일
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
Walter Roberson
Walter Roberson 2015년 12월 11일
Could you give a couple of sample lines? And also please show your current textscan attempt.

댓글을 달려면 로그인하십시오.

답변 (1개)

dpb
dpb 2015년 12월 11일
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.

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by