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

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 Commento

See textscan:
  • 'EmptyValue' — Returned value for empty numeric fieldsNaN (default) | scalar
  • 'TreatAsEmpty' — Strings to treat as empty valuestring | cell array of strings

Accedi per commentare.

Risposte (0)

Categorie

Richiesto:

Lee
il 24 Nov 2014

Commentato:

il 25 Nov 2014

Community Treasure Hunt

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

Start Hunting!

Translated by