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!