Matlab coding to show the string in one line
조회 수: 1 (최근 30일)
이전 댓글 표시
I have data in txt file as shown below.
aaaaaaaaaaaaaaaaaaaaaafffffffff
eeefffffaaaaaaaaaaaeeeeeeeeeeee
now,I have to show the result or ouput as shown below
'aaaaaaaaaaaaaaaaaaaaaafffffffffeeefffffaaaaaaaaaaaeeeeeeeeeeee'
I have writtten a prog.
x=fopen('data.txt','r');%data.txt contains above data
X_t=textscan(x,'%s')
A=X_t{1}
But the output is
A{1} ='aaaaaaaaaaaaaaaaaaaaaafffffffff'
A{2}='eeefffffaaaaaaaaaaaeeeeeeeeeeee'
This is not desired output.Please help............
댓글 수: 0
채택된 답변
Andrei Bobrov
2012년 9월 13일
편집: Andrei Bobrov
2012년 9월 13일
out = [A{:}];
or
out = cat(2,A{:});
or
out = strcat(A{:});
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!