Thread Subject: matrix dimensions problem with textscan

Subject: matrix dimensions problem with textscan

From: burcu

Date: 23 Oct, 2009 16:55:21

Message: 1 of 1

I'm trying to read a file that includes strings and numerical data with textscan command. After importing this data, i'll use it for neural network training.
My dataset is kdd'99 dataset ( could be seen here: http://mlr.cs.umass.edu/ml/databases/kddcup99/kddcup99.html will use 10% ones) and looks like:

0,tcp,smtp,SF,829,327,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0.00,0.00,0.00,0.00,1.00,0.00,0.00,8,113,0.88,0.25,0.12,0.02,0.00,0.00,0.00,0.00

Data dimensions are very large, so want to make a trial with first 19 rows of the dataset and used this commands:

fid = fopen('ked.txt');

hadi=textscan(fid, '%u8, %s, %s, %s, %u16, %u16, %u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%u8,%f,%f,%f,%f,%f,%f,%f, %u16, %u16,%f,%f,%f,%f,%f,%f,%f,%f',19);

fclose(fid);

Then let's say i need to set the first 3 columns of first 15 lines as training data, so i use this command:

 P= hadi(1:15, 1:3);
and i get this error:
??? Index exceeds matrix dimensions.

hadi is 1x42 matrix, and i cant fix it to be 19x42. My matlab version is R2006a.

PS: i've also tried textscantool but i've also faced with different errors, couldnt even make it work.

All the suggestions are welcome!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
textscan burcu 23 Oct, 2009 12:59:04
rssFeed for this Thread

Contact us at files@mathworks.com