필터 지우기
필터 지우기

Remove text from matrix

조회 수: 4 (최근 30일)
Momo
Momo 2012년 12월 20일
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.

채택된 답변

Momo
Momo 2012년 12월 20일

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 12월 20일
textscan() with CommentStyle 'F' and format repmat('%f',1,7)
  댓글 수: 3
Momo
Momo 2012년 12월 20일
Walter Roberson
Walter Roberson 2012년 12월 20일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by