Importing arbitrary assymetric matrix

조회 수: 2 (최근 30일)
Rafael
Rafael 2013년 10월 15일
댓글: Rafael 2013년 10월 15일
Hello,
I need to import data from a file like that in Matlab
825.077985928 , 803.976586577 , 7.94328234724E+6
746.602923264 , 746.380023451 , 8.91250938134E+6
669.973486472 , 685.594867998 , 1.E+7
608.553696091 , 622.808380226 , 1.1220184543E+7
535.301644385 , 564.919488252 , 1.25892541179E+7
0 0 3.8 2 0 0 0 0 .1 .1 5 5 4 4 20 14 142 13 Sep 1900 10:24:07 519 LSGM 1 AG 0 100 0 0 0 0 5 0 0000 ¯Z'(E4 ) ¯Z"(E4 ) 13.49+25
I have tried to use many functions of matlab, therefore it have not worked! I would be very grateful if anyone could help me.
Thanks in advance!

답변 (2개)

Walter Roberson
Walter Roberson 2013년 10월 15일
Which parts are always the same length and which parts are variable length?
MATLAB does not offer any tools to automatically import files that have different input formats for different lines. The more the lengths are fixed and the formats are fixed, the easier it is to work with the existing tools.
  댓글 수: 1
Rafael
Rafael 2013년 10월 15일
All data have three colums delimited by ','... Therefore, the last line have an arbitrary format. The problem is that I have hundreds of files like that. Actually, they are generated by conversion of HP format to IBM format using LifUtilities... So, I would like to be able to delete last line or to avoid to read last line.

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


Jie
Jie 2013년 10월 15일
편집: Jie 2013년 10월 15일
try
textscan()
or
strread()
but as Walter posted, "The more the lengths are fixed and the formats are fixed, the easier it is to work with the existing tools."
  댓글 수: 1
Rafael
Rafael 2013년 10월 15일
My probelm is the last line that have an arbitrary format. The problem is that I have hundreds of files like that. Actually, they are generated by conversion of HP format to IBM format using LifUtilities... So, I would like to be able to delete last line or to avoid to read last line.

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

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by