shuizhilei3334 2013-10-29 14:48 采纳率: 0%
浏览 5055

matlab字符串文本读入问题

下面是我需要读入的字符矩阵
F F T T Some $$$ F T French 0-10 T
T F F T Full $ F F Thai 30-60 F
F T F F Some $ F F Burger 0-10 T
T F T T Full $ F F Thai 10~30 T
T F T F Full $$$ F T French >60 F
F T F T Some $$ T T Italian 0-10 T
F T F F None $ T F Burger 0-10 F
F F F T Some $$ T T Thai 0-10 T
F T T F Full $ T F Burger >60 F
T T T T Full $$$ F T Italian 10~30 F
F F F F None $ F F Thai 0-30 F
T T T T Full $ F F Burger 30-60 T
我不知道用什么命令好,用textscan和textrean出现了下面的问题:
A=textread('sample.txt','%s %s %s %s %s %s %s %s %s %s %s');
Error using dataread
Number of outputs must match the number of unskipped input fields.

Error in textread (line 176)
[varargout{1:nlhs}]=dataread('file',varargin{:});
哪位大神能帮忙解答一下

  • 写回答

3条回答

  • IEET_121 2015-07-01 12:35
    关注

    [a, b, c, d, e, f, g, h, l, m,n] = textread('mf1.txt','%s %s %s %s %s %s %s %s %s %s %s')

    [a b c d e f g h l m n]

    ans =

    'F'    'F'    'T'    'T'    'Some'    '$$$'    'F'    'T'    'French'     '0-10'     'T'
    'T'    'F'    'F'    'T'    'Full'    '$'      'F'    'F'    'Thai'       '30-60'    'F'
        ..........
    
    评论

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容