MATLAB: Plotting multiple text files columns in the same graph columnsgraphMATLABmultiple filesplotrowstext;txttxt filetxtx Hi guys, I have about 25 files consisting of 300 rows and 3 columns. I'd like to plot the first column of each file in the same graph. Is it possible? Thanks in advance ! Best Answer workDir = 'C:\Users\gabri\Desktop\Nova_pasta\Arquivos_Saida_Imex';delimiter = '\t';startRow = 6;%your description says three columns, your code says four, your previous format implied their might be moreformatSpec = '%f%f%f%f';for i = 1:25 this_subdir = sprintf('%d', i); filename = fullfile( workDir, this_subdir, 'arqanepi.rwo'); %%Open the text file. fileID = fopen(filename, 'rt'); dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'HeaderLines', startRow-1, 'ReturnOnError', false); %%Close the text file. fclose(fileID); %%Allocate imported array to column variable names days(:,i) = dataArray{:, 1}; Oil(:,i) = dataArray{:, 2}; Gas(:,i) = dataArray{:, 3}; Water(:,i)= dataArray{:, 4};endplot(days(:,1), Oil) Related SolutionsMATLAB: How to import from a csv with a different file name https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html See the last example to read multiple files with different names using dir() MATLAB: Convert datetime to milliseconds For datetime objects,ms = milliseconds(time - time(1)); Related QuestionImport txt file containing some comment character = “#”Quiver Plot not plotting all dataHow to import multiple (147) text files in MatlabImport multiple ftext files in MATLAB_ Names of files are datesCreate a function to extract data several csv filesInvalid expression in reading the file
Best Answer