matlab - Import data from file delimited with various number of spaces -
I am trying to read in a data array in a data array, but there are two problems
1) The delimiter is an empty space which varies in each column
2) Among the entries in 4 columns, there are question marks instead of numbers
This data is read in a cell What is the best way to array the file? Try the following:
398x 9 in cell The array of stars x = IMPORTDATA ('auto- mpg.data '); % // Reading Line y = Room (number (x), 9); Prellocate with 9 cols (acccording to your file) for N% 1: numel (x) y (n, :) = regexp (x {n}, '(\ s \ s +) | \ t', ' split '); To divide each line, split each row into more than one place or one tab% // (according to your file)
y
Comments
Post a Comment