Read from file

Hi all,
How can i read a file with this format:
x1 (((x2 x3 x4) (x5 x6 x7)) ((x8 x9 x10) (x11 x12 x13)))
where x_n are numbers. I do not know how to skip the brackets.
Regards
Andrea

댓글 수: 1

Jan
Jan 2012년 3월 5일
What is the desired output?

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

답변 (1개)

Ken Atwell
Ken Atwell 2012년 3월 5일

1 개 추천

If you really want to just ignore the the parenthesis, you can treat them as "whitespace" characters in a call to textscan:
f = fopen('test.dat')
data=textscan(f, '%f', 'Whitespace', ' \b\t()')
fclose(f)
"data" will be a 1x1 cell array containing a numeric array with your data.

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

질문:

2012년 3월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by