txtファイルからスペース区切りで改行しながら、周期的にインポートする方法を教えてください。
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
現在、添付したsample.txtのようなファイルがあります。
これを、下記の形でtableにインポートしたいです。
方法をご教示願います。
00000001
00000002
00000003
00000004
00000005
00000006
00000007
00000008
00000009
00000010
0 Kommentare
Akzeptierte Antwort
Atsushi Ueno
am 13 Sep. 2022
readtable関数を用います。
一つおきに入っている"00000000"は上位の桁とみなすのでしょうか? 下記は単に"00000000"を読み飛ばす例です。
tbl = readtable('sample.txt', ... % 読み込むファイル名
'TextType', 'string', ... % インポートされるテキストデータの型('char'|'string')
'ReadVariableNames', false, ... % 最初の行を変数名として読み取るか否か
'Delimiter',' ', ... % フィールドの区切り記号
'NumHeaderLines',4, ... % ヘッダーの行数
'Format','%s %*s') % 列の形式。%*s⇒%sに変えると"00000000"も読み込む
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu スプレッドシート finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!