【问题标题】:Change number of imported columns in 'importdata' in MATLAB在 MATLAB 中更改“importdata”中的导入列数
【发布时间】:2014-09-01 12:14:24
【问题描述】:

我正在尝试读取一个非常大的 .seq 文件。它有数千行和可变数量的列(从 1 到 20),用“空格”分隔。 我通常使用 importdata 命令。但是,这一次,此命令将此数据导入到只有 2 列的矩阵中。有没有办法让 importdata 命令使用更多的列? 我也尝试使用 dlmread,但 MATLAB 说: 内存不足。

【问题讨论】:

    标签: matlab import


    【解决方案1】:

    使用xlsread。您可以将块与 xlsread 一起使用。一次阅读几千篇。

    可以通过 xlsread 中的范围输入参数来完成。在范围本身中,您也可以指定列..

    语法:

    num = xlsread(filename,sheet,xlRange)
    

    例子:

    filename = 'myExample.xlsx';
    sheet = 1;
    xlRange = 'B2:C3';
    
    subsetA = xlsread(filename, sheet, xlRange)
    

    也请阅读:http://www.mathworks.com/help/matlab/import_export/import-large-text-files.html#zmw57dd0e3117

    【讨论】:

    • 谢谢。但不是 xlsread 仅适用于 excel 文档。 MATLAB 显示错误文件不是 Microsoft Excel 格式。
    • 看看 textscan.. 示例:C = textscan(fileID,formatSpec) 并阅读我传递给您的大文本文件链接..
    【解决方案2】:

    我一般用readtable:

    filename = 'x64.res'; F = readtable(filename,'FileType','text','Delimiter','\t');

    【讨论】:

      猜你喜欢
      • 2014-07-02
      • 2014-07-08
      • 2014-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-20
      • 1970-01-01
      相关资源
      最近更新 更多