Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の文字列があるとします。
s = 'フー 1.000 3.000 3.554'
textscan以下のような関数で読みたいと思います。
textscan
[name xyz] = textscan(s, '%s %f %f %f')
ただし、これを行うと、常にToo many output argumentsエラーが発生します。
Too many output arguments
セル配列を出力するという事実に関係していると思いますが、textscanこの問題と目的の効果を回避する方法を見つけることができませんでした。
必要なことを行うには、2 行が必要です。最初に、目的の値をダミー変数に取得し、次にデータを次のように配布しますdeal。
deal
dummy = textscan(s, '%s %f %f %f'); [a,b,c,d] = deal(dummy {:});