Remove text from matrix

Hello,
I have a matrix data of n rows(more than 1000) and p columns(exactly six). In this matrix I have a text data repeated each 25 rows. To be more clear I will give you an example:
%row1% Freq X Y Z deltaX deltaY deltaZ
10 20 30 40 50 60 70
1 2 3 4 5 6 7
.......
1 2 3 4 5 6 7
%row26% Freq X Y Z deltaX deltaY deltaZ
0.1 0.2 0.3 0.4 0.5 0.6 0.7
.......
my question is to how import this data and remove the text data. Knowing that I have tried the simple command %
importdata('filename.dat');
but it imports only the first 25 rows.
Thank you in advance for you precious help.
M.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 20 Déc 2012

1 vote

textscan() with CommentStyle 'F' and format repmat('%f',1,7)

3 commentaires

Momo
Momo le 20 Déc 2012
Thank you for your response. I tried this code but it doesn't work: fid= fopen('filename.dat') textscan(fid, 'repmat('%f',1,7), 'F')
Momo
Momo le 20 Déc 2012
You cannot just add the 'F' by itself: you have to use
textscan(fid, repmat('%f',1,7), 'CommentStyle', 'F')
Also note that the repmat() is not quoted.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Import and Analysis dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by