Hi,

I have a text file formatted

`#########-10-K-#################-10-K-########...`

I want to bring the entire contents of the lines into an nx1 matrix or array, where n is the number of lines in my text file.

So far I have tried:

`x=fscanf(fn, '%f-10-K-%f\n', [inf])`

which creates a 2nx1 matrix where the first float is the first entry, and the second float is the second entry.

`x=fscanf(fn, '%[0123456789-K\n]', [inf])`

which honestly seems to have worked except for the fact that is results in a 1×67165 char array.

`x=fscan(fn, '%[0123456789-K]\n', [inf])`

which just results in one really long string.

I have also tried

`x=fscan(fn, '%f%c%d%d%c%c%c%f\n', [inf])`

which isn't working.

Any tips?

## Best Answer