Matlab Programming Language Question: How to read part of txt file into a matrix
Hi, it's been a while since I've used Matlab, so bare with me.
I am running Matlab 7.2.0.232 on WindowsXP.
I have a txt file and I want to read part of that text file into a matrix.
Here is an example of the text in the text file:
lines of text of variable length and content...
lines of text of variable length and content...
lines of text of variable length and content...
{c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
1 float float int int float float float float int int int int int int int int
2 float float int int float float float float int int int int int int int int
3 float float int int float float float float int int int int int int int int
.
.
.
.
N float float int int float float float float int int int int int int int int}
EndOfFile;
I want to read the part between the braces ({ }) into a matrix (note that the braces are not in the txt file...I am using them here for id purposes only). The first row are colmumn headers. The first number in every row is a row id from 1 to N, where N is the total number of rows. N is a variable and can be any where from 1 to 1,000,000, but is usually around 10,000. The number of columns is fixed at 17.
Once I have the data into a matrix I can manipulate it.
There are several functions that might help...
The best for this type of file would probably be: data=dlmread('filename',delimeter,R,C)
where
'filename' is the file to read
delimeter is the delimeter seperating fields (eg: space, tab, comma)
R, C Row and Column to start reading
The best for this type of file would probably be: data=dlmread('filename',de
where
'filename' is the file to read
delimeter is the delimeter seperating fields (eg: space, tab, comma)
R, C Row and Column to start reading