How can I read a text file and store its data inside a matrix?
4 ビュー (過去 30 日間)
古いコメントを表示
I am trying to import text files, and convert it's data into a matrix. When I import the file, it stores it as a 50x1 cell, how can I convert this to a 50x9 or 50x10 matrix, where I can reference each aspect of the file individually?
fid = fopen ('40_8deg_HL_Both.txt', 'r');
data = textscan(fid, '%s', 'HeaderLines', 9, 'delimiter', '/n');
fclose (fid);
mat = data{:};
0 件のコメント
採用された回答
KSSV
2019 年 3 月 22 日
clc; clear all ;
fid = fopen ('40_8deg_HL_Both.txt', 'r');
data = textscan(fid, '%s %s %f %f %f %f %f %f %f %s', 'HeaderLines', 9);
fclose (fid);
A = [data{3:9}]
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!