I have a text file which has 500 columns and 500 rows, of numerical(integer) values . Every element in the row is separated by a tab. I want to rea
500 columns
500 rows
% Pre-allocate matrix Nrow=500; Ncol=500; a = zeros(Nrow,Ncol); % Read file fid = fopen('yourfile.txt','r'); for i:1:Nrow a(i,:) = cell2mat(textscan(fid,repmat('%d ',Ncol)); end fclose(fid); % Trasnspose matrix a_trans = a.';