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 = 'Foo 1.000 3.000 3.554'
我想用textscan如下功能阅读它。
textscan
[名称 xyz] = textscan(s, '%s %f %f %f')
但是,当我这样做时,我总是会收到Too many output arguments错误消息。
Too many output arguments
我认为这与输出单元格数组的事实有关textscan,但我无法发现如何解决这个问题和预期的效果。
你需要两条线来做你想做的事。首先,您将所需的值放入一个虚拟变量中,然后将数据分配给deal:
deal
dummy = textscan(s, '%s %f %f %f'); [a,b,c,d] = deal(dummy {:});