Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8176479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:11:37+00:00 2026-06-06T23:11:37+00:00

I have 100 .dat files in a folder. Is it possible to read all

  • 0

I have 100 .dat files in a folder. Is it possible to read all the files at once with MATLAB and do average of the 5th column of those 100 files? Here is a sample of one of the .dat files.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:11:39+00:00Added an answer on June 6, 2026 at 11:11 pm

    Here is some code to get you started:

    %# get list of 100 .dat files
    pathToFolder = '.';
    files = dir( fullfile(pathToFolder,'*.dat') );
    
    %# read all files
    data = cell(numel(files),1);
    for i=1:numel(files)
        fid = fopen(fullfile(pathToFolder,files(i).name), 'rt');
        H = textscan(fid, '%s', 4, 'Delimiter','\n');
        C = textscan(fid, repmat('%f ',1,8), 'Delimiter',' ', ...
            'MultipleDelimsAsOne',true, 'CollectOutput',true);
        fclose(fid);
        H = H{1}; C = C{1};
    
        %# store numeric data and ignore the header lines
        data{i} = C;
    end
    
    %# we assume all tables have the same size
    data = cat(3,data{:});
    mn = mean(data(:,5,:),3)    %# mean of 5th col across 100 files
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two source files created in unix folder say file1.dat and file2.dat. I
I have 100 text files which contains time series starting and ending at different
I have 100 training, lecture, guide video files which has size 30MB to 1GB
Here is my problem, I'm trying to read in data from a file beginningbalance.dat
I have 100 daughter files with the same extension like thin1.txt thin2.txt thin3.txt .
I have 100 pictures in my Resources folder and they can really be annoying
I have 100 files and need to append a line in the end of
I have 100 text files in a directory. The format of the filename is
I have a file numbers.dat containing about 300 numbers(floating point,negative positive)in column format. The
I have 100 inputs with the name table[] . How can I get their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.