How to import data with '?'s to feed into knnimpute

조회 수: 3 (최근 30일)
Lee
Lee 2014년 11월 24일
댓글: per isakson 2014년 11월 25일
Hi community! So I have a csv file where I want to import the csv numbers on each line into a row of a matrix. For instance:
1, 3, 4 1, 2, 5
would import into matrix [1 3 4; 1 2 5]. There are various ways to do this is matlab (csvread, for instance), but they don't handle '?'s.
How can I convert this type of data into a form that knnimpute can handle as an input? The examples all have matrixes with NaN values, but I am having trouble turning my data into a matrix with NaN values where my '?'s are.
Thanks for any advice or comments, all appreciated
  댓글 수: 1
per isakson
per isakson 2014년 11월 25일
See textscan:
  • 'EmptyValue' — Returned value for empty numeric fieldsNaN (default) | scalar
  • 'TreatAsEmpty' — Strings to treat as empty valuestring | cell array of strings

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

답변 (0개)

카테고리

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