Louis,
I don't think dlmread or csvread support reading string data (I may be wrong here, but I've never found a way to make that work), which is why you're getting 0's as output. For example, if we modify your data file so its content is:
1.2,3
1.1,4
1.1,6
1.4,7
Then run
data=dlmread('test.data', ',')
We get
data =
1.2000 3.0000
1.1000 4.0000
1.1000 6.0000
1.4000 7.0000
I've worked around this using fopen, fgetl and str2num. I've uploaded a script gpst.m I wrote to decode raw GPS data using this exact technique. The skinny is, you can store the whole line as a string using fgetl, then parse it based on known patterns, because in the string x = 'abced', for example, x(2) is b. You can use str2num to convert your numbers into workable array parts, and go from there. This isn't necessarily best, but it's a quick and dirty solution I've used.
There are a couple of ways to store both string data and numerical data, by using cells or data structures. Depending on your application, you might use one or the other (or a combination). The problem here is that data stored in a cell first has to be extracted and converted to a numerical matrix before you can do matrix operations on it. With a structure, you can call structure elements that are matrices/numbers and they will behave as expected. Example:
Using cells:
-->x = {'aaa' 1.2 3;'bbb' 1.1 4; 'ccc' 1.1 6; 'ddd' 1.4 7}
x =
[aaa] [1.2] [3]
[bbb] [1.1] [4]
[ccc] [1.1] [6]
[ddd] [1.4] [7]
--> x(:,2)
ans =
[1.2]
[1.1]
[1.1]
[1.4]
ans is still a cell, so we can't directly do matrix operations on it:
--> 3*x(2,2)
Error: Cannot perform type conversions with this type
Using structures:
--> x.text = {'aaa'; 'bbb'; 'ccc'; 'ddd'}; x.data = [1.2 3; 1.1 4; 1.1 6; 1.4 7];
--> x.text
ans =
[aaa]
[bbb]
[ccc]
[ddd]
--> x.data
ans =
1.2000 3.0000
1.1000 4.0000
1.1000 6.0000
1.4000 7.0000
--> 3*x.data
ans =
3.6000 9.0000
3.3000 12.0000
3.3000 18.0000
4.2000 21.0000
Hope this helps.
Cheers,
TJ