how to read a file and convert to matrix format
2 次查看(过去 30 天)
显示 更早的评论
i am reading a file which has the values in the form
v -0.141202 5 5
v 3 5 5
v 4 5 5
i want to convert this in the form of a cell ignoring space ie in the form of 3X4 matrix
Thanks in advance
0 个评论
采纳的回答
Azzi Abdelmalek
2012-9-28
fid = fopen('filename.txt');
out=textscan(fid,'%s')
fclose(fid);
out=reshape(out{:},4,[])'
2 个评论
Azzi Abdelmalek
2012-10-1
for jj =1:4
fid=fopen(sprintf('Secret1%d.obj',jj),'r' )
out=textscan(fid,'%s')
fclose(fid);
res{jj}=reshape(out{:},4,[])'
end
更多回答(1 个)
Sumit Tandon
2012-9-28
There are several options - e.g. using Import Wizard or TEXTSCAN command.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!