I have a .csv file with the following 'configuration'
'string', 'string', 'string', 'string', 'string'
'string', 'string', 21, 89, 67
'string', 'string', 45, 12, -16
'string', 'string', 78, 56, 45
'string', 'string', 23, 65, 90
'string', 'string', 43, 34, 75
I would like to ignore the first two columns and the first row, and import the numbers to a matrix.
I have tried using textscan, but without luck. Any experts? :-)
Try dlmread. You can specify the row and column to start the import.
data = dlmread('test.txt',',',1,2)
data =
21 89 67
45 12 -16
78 56 45
23 65 90
43 34 75
Use importdata:
x = importdata('filename.csv');
This gives an x struct with data and textdata fields:
>> x
x =
data: [5x3 double]
textdata: {6x5 cell}
To get only the numeric values, use
x_numeric = x.data;
In your example, this gives
x_numeric =
21 89 67
45 12 -16
78 56 45
23 65 90
43 34 75
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With