我如何在Matlab中读取不同的文本文件

时间:2014-05-31 17:26:32

标签: matlab file-io text-files text-mining

如何在Matlab中阅读不同的文本文件。 考虑到有33个txt文件,每个文件都应该被处理。 以下是我的错误代码的一部分。

   textFilename = cell(1,33);
        id = cell(1,33);
        for k=1:33;
        textFilename{k} = fullfile('C:\Users\Desktop\SentimentCode\textfiles',['file' num2str(k)     '.txt']);
        id{k} = fopen(textFilename{k},'rt'); 
        str{k} = textscan(id{k},'%s%s'); 


    str(str == '.') = '';
    str(str == '_') = '';
    str(str == '-') = '';


% Remove numbers from text
    T =regexprep(str, '[\d]', ' ');   
end    

我的错误是:

??? Undefined function or method 'eq' for input arguments of type 'cell'.
Error in ==> Untitled9 at 23
str(str == '.') = '';

0 个答案:

没有答案
相关问题