Question

I want to read the training.csv file with Octave for the Kaggle competition. The file contains 16 fields. First 15 are the coordinates of keypoints. The 16th is is the image, which is 9216 numbers (0 to 255) separated by space.

Tried, but with no luck the followings:

 - data = csvread('training.csv'); 

 - data = dlmread('training.csv', ',');

 - [l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15, image] =
   textread("training.csv", "%f %f %f %f %f %f %f %f %f %f %f %f %f %f
   %f %s", "delimiter", ",", "endofline", "\n", "headerlines", 1);

Note:

Thanks,

Was it helpful?

Solution

This post contributed greatly to figure this out. The key is to:

  • Remove the header row
  • Replace the ",,"(double commas) with "0"
  • Replace ","(single comma) with " " (space)
  • The code to read the file

    fn = 'training_space.txt'; M = dlmread(fn);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top