How to read a line in atxt file with different formats?

1 回表示 (過去 30 日間)
Mia
Mia 2016 年 12 月 6 日
回答済み: KSSV 2016 年 12 月 6 日
I need to import a row vector printed in a txt file. The line contains a word, followed by the numerical values of a vector. Problem is I don't know how to read a row vector without knowing it's length in advance. I've tried using textscan:
textscan(fid,['word' ,repmat('%f',[1,inf])]);
This obviously does not work. Would appreciate any ideas regarding reading a row vector. Thanks in advance

回答 (1 件)

KSSV
KSSV 2016 年 12 月 6 日
data = importdata('yourfile.txt') ;
num = data.data ;

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by