【问题标题】:Load in multiple input files with for-loop [duplicate]使用for循环加载多个输入文件[重复]
【发布时间】:2018-02-01 22:22:18
【问题描述】:

我有多个(准确地说是 264 个)具有年降水量的文件,它们被命名为“precip1752.xlsx”、“precip1753.xlsx”、...“precip2016.xlsx”。如何使用 for 循环一次加载所有这些文件?

提前致谢!

【问题讨论】:

    标签: matlab for-loop file-upload


    【解决方案1】:

    假设文件位于名称为 dirName 的目录中。

    D = dir([dirName '*.xlsx']);
    for di = 1:length(D)
        filePath = fullfile(dirName, D(di).name);
        % insert code here to process file named filePath using xlsread
    end
    

    使用xlsread 函数将数据读入MATLAB。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-26
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 2016-11-21
      • 2015-09-29
      • 1970-01-01
      • 2017-08-28
      相关资源
      最近更新 更多