fscanf

2 次查看(过去 30 天)
Tor Fredrik Hove
Tor Fredrik Hove 2011-10-28
When i try to read a file, this one:
3.0000000e+000 4.0000000e+000 5.0000000e+000 4.0000000e+000 5.0000000e+000 6.0000000e+000 I get
>> fid=fopen('samematrix.mongiss', 'r')
fid =
4
>> fscanf(fid, '%f%f%f')
ans =
3
4
5
4
5
6
>>
I want to have rows made to columns as it says that fscanf will do.

采纳的回答

Wayne King
Wayne King 2011-10-28
Hi Tor,
fid=fopen('samematrix.mongiss', 'r')
data = fscanf(fid,'%f');
  1 个评论
Wayne King
Wayne King 2011-10-28
It does return the row as a column

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Low-Level File I/O 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by