テキストファイルをスペースで区切り、array化する方法を教えてください。
Show older comments
readcell()によってテキストファイルをarray化するとき、"," (コンマ)ではなく" "(スペース)で区切りたいのですがどうすればよいでしょうか
Answers (1)
Kojiro Saito
on 23 Jun 2022
t = readcell('mytext.txt', 'Delimiter', ' ');
上記でうまくいかなかったらdetectImportOptionsでオプションを指定することで可能です。
opts = detectImportOptions('mytext.txt');
opts.Delimiter = ' ';
t = readcell('mytext.txt', opts);
Categories
Find more on スプレッドシート in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!