문제

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,

도움이 되었습니까?

해결책

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);

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top