MATLAB: Need to separate data from single set to 6 separate sets

separating column information

Hello,
I am relatively new to Matlab and need help. I have data from one program, which is x,y,z data. the data is set up as five points in a row across a path. The rows are separated by a delimiter line that reads 9999 9999 9999 as shown below. I want to arrange the data so that I have 5 separate arrays of data based on the five columns separated by the 9999 9999 9999. The data file is sometimes long so I want to automate the process so that it will stops when it reaches the end of the data, which is 9999 9999 9999.
424209.7600 3225125.4000 -1102.87
424206.7600 3225125.4000 -1102.84
424203.7600 3225125.4000 -1102.80
424200.7600 3225125.4000 -1102.82
424197.7600 3225125.4000 -1102.84
9999 9999 9999
424209.7600 3225122.4000 -1102.98
424206.7600 3225122.4000 -1102.95
424203.7600 3225122.4000 -1102.89
424200.7600 3225122.4000 -1102.93
424197.7600 3225122.4000 -1103.00
9999 9999 9999

Best Answer

I'm only seeing 3 columns, not 5 like you said. So, I'd do this.
Untested off the top of my head
array = dlmread(filename, ' ');
badRows = array(:,1) == 9999;
array = array(~badRows, :); % Extract only the good rows.
Split into columns.
x = array(:, 1);
y = array(:, 2);
z = array(:, 3);
If you then want to have dozens of 5 row by 3 column or 5 row by 1 column arrays, you can do that too.
Related Question