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 1032185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:02:34+00:00 2026-05-16T14:02:34+00:00

I want to read data of average saturation (%) for water as shown below.

  • 0

I want to read data of average saturation (%) for water as shown below. This data is a partial form of a large file, however the average water saturation (%) REPEATS itself in the given format only.

Average Pressure 
   Total Pore Volume  psia      3884.9                                                                                              
   HC. Pore Volume    psia      3884.9                                                                                              
 Average P/Z 
   Total Pore Volume  psia      4457.8                                                                                              
   HC. Pore Volume    psia      4457.8                                                                                              
 Average Saturation %
   Oil                          84.911                                                                                              
   Gas                          .08873                                                                                              
   Water                        15.000                                                                                              
 Percentage Recovery 
   Stock Tank Oil               .02211                                                                                              
   STO as a % of Mobile Oil     .02891                                                                                              
   Total Gas                    .02034                                                                                              
   Water                        62e-12

I was trying to do it by using readline.m function, but unfortunately the position of average water saturation (%) data is not fixed by line number. The line number changes for similar kind of output file for different models.

This is what I was trying to do:

%# Reading Water Saturation (Sw) data from output (.OUT) file of reservoir model
    Sw_LineNo=[554,968,1120,1272,1424,1576,1728,1880,2032,2184,2336,2488,2640,2792,2944,3096,3248,3400,3552,3704,3856]; % This column vector contains the line numbers of the .out file with Sw values for year 1 till 20

    for i=1:size(Sw_LineNo,2)
    read_value=readline('ReservoirModel_ExplorWell_CMGBuilder.out',Sw_LineNo(i)); % read_value stores values in form of string
    Swav_Data_E_W(i,j)=str2num(read_value(33:38)); % converts the required portion of string (Sw value) to number
    end

Now if my model (ReservoirModel_ExplorWell_CMGBuilder.out) changes, then the line numbers where the average saturation (%) for water lies in the text file also changes. Thus Sw_LineNo changes for different models, and I have large number of models.

Please suggest correct way to read all the average saturation (%) for water data.

  • 1 1 Answer
  • 1 View
  • 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-05-16T14:02:34+00:00Added an answer on May 16, 2026 at 2:02 pm
    %# Reading Average Water Saturation (Savw) data from output (.OUT) file of reservoir model
        fid = fopen('ReservoirModel_CMGBuilder.out'); % open the file
    
        dotOUT_fileContents = textscan(fid,'%s','Delimiter','\n'); % read it into one big array, row by row
        dotOUT_fileContents = dotOUT_fileContents{1};
        fclose(fid); %# don't forget to close the file again
    
        %# find rows containing 'Average Saturation %'
        Swav_Starts = strmatch('Average Saturation %',dotOUT_fileContents); % Swav_Starts contains the line numbers wherever 'Average Saturation %' is found
        nSwav = length(Swav_Starts); % total no. of Swav values will be equal to the total no. of 'Average Saturation %' read from the .out file
    
        %# loop through the file and read the numeric data
        for w = 1:nSwav 
            %# read lines containing numbers
            tmp_str = dotOUT_fileContents(Swav_Starts(w)+3); % stores the content of the 3rd row from the row containing 'Average Saturation %' in form of string
            tmp_str = tmp_str{:}; % store the content of the string which contains Swav, as well, in form of a character
            %# assign output
            Swav_yearly(w,j) = str2num(tmp_str(30:35)); % convert the part of the character containing Swav into number
        end
    

    Now the tmp_str = dotOUT_fileContents(Swav_Starts(w)+3); produces the following string:

    Water                        15.000 
    

    If I try to convert it to number using str2num, then I get an empty matrix. So I pick the characters of this string containing the saturation value (here 15.000) and then changing this character to number as follow, giving the value of the average water saturation:

    str2num(tmp_str(30:35))
    

    Please advice if someone has any method to extract number out of the string without picking the characters as I have done.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file as below and I want to read data from
I have an xml file as below and I want to read data from
I want to read data about MMORPG characters from a .txt file and then
i want simultaneously read and write data into file. Can i use StreamReader and
I have Uitable with data read from a AScii file. I want to select
I have a large array in RAM and want to read data from it
I want to read a fairly large xml file. Its small enough to fit
How do I read data from a file if my file is like this
i want read data from the binary file named xyz.bin and want to parse
I want to read data from XML file but it showing the following errors:

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.