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

2 views (last 30 days)
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 Comment
per isakson
per isakson on 25 Nov 2014
See textscan:
  • 'EmptyValue' — Returned value for empty numeric fieldsNaN (default) | scalar
  • 'TreatAsEmpty' — Strings to treat as empty valuestring | cell array of strings

Sign in to comment.

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!