Convert from textread() to textscan()

19 ビュー (過去 30 日間)
joeyapp
joeyapp 2013 年 2 月 16 日
I'm trying to update my code and was wondering if anyone can help with this simple question:
How would these two lines transfer over from textread() to textscan() in matlab?
[x,y,z]=textread(filename,'%f %f %f %*f %*f %*f','headerlines',3);
[X(:,k),Y(:,k),Z(:,k)]=textread(filenames,'%*f %*f %*f %f %f %f','headerlines',3);
  1 件のコメント
Jan
Jan 2013 年 2 月 17 日
Please send an enhancement request to TMW and ask for not removing textread. There is no advantage in removing working commands.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2013 年 2 月 17 日
Assuming the same file is being referenced for both:
fid = fopen(filename);
xyzcell = textscan(fid, '%f %f %f %f %f %f', 'HeaderLines', 3);
fclose(fid);
x = xyzcell{1};
y = xyzcell{2};
z = xyzcell{3};
X(:,k) = xyzcell{4};
Y(:,k) = xyzcell{5};
Z(:,k) = xyzcell{6};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by