I have a folder with numberous text files, each file have some numeric data of interst that I'm trying to extract, with the data from other files, into a single big array. Here's my approach:
dr = uigetdir()d= dir([dr,'\*.txt'])N = length(d)A = zeros(1000,N)for k = 1:N [fileLIST, FOLDER] = fopen(d(k).name, 'r'); if fileLIST<0, error(['Failed fopen: ' d(k).name FOLDER]), end A(:,k)= textscan(fileLIST, '%f%f%*s%*s%*s%*s%*s%*s%*s%[^\n\r]', ... 'Delimiter', '\t', 'headerlines', 3, 'ReturnOnError', false); fclose(fileLIST);end
I have to use textscan with these parameters to get my data of interest from txt files, however I keep getting 'Conversion to double from cell is not possible'. I tried to wrap textscan inside a cell2mat, and it's not working either (All contents of the input cell array must be of the same data type). Can you please help me figure that out? Thanks!
Best Answer