0 Replies - 377 Views - Last Post: 10 October 2015 - 09:34 AM Rate Topic: -----

#1 Ameri   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 26-October 13

Read multiple text files in MATLAB

Posted 10 October 2015 - 09:34 AM

Hi there,

I need to read "a specific number" (highlighted below) in 1998 different text files (text1.txt, text2.txt, ..., text1998.txt) simultaneously and print that numbers in another file (preferably, an excel file). All the files are a mixture of strings and numbers and look like as follows:

Structure: Biaxial House model with 1 story.

Maximum responses---------------------------
Displacements: X Y R
Story--1: 1.267323e+000 1.251265e-016 1.574376e-011

Maximum Inter-story responses---------------------------
Inter-story Drifts: dX dY dR
Story--1: 1.267323e+000 1.251265e-016 1.574376e-011

Maximum story forces---------------------------
Total force at story: Fx Fy Mr
Story--1: 6.152071e+003 1.364242e-012 4.009894e-003

Maximum story Accelerations---------------------------
Global Accel at story Centroid: Ax Ay Ar
Story--1: 3.860713e+001 9.869805e-017 3.364166e-010

The average acceleration is calculated using a 0.01sec time interval
Note: If the specified time interval is smaller than the time interval of input excitation, the excitation time interval is used to calculate the average Accel.
Maximum story Average Accelerations---------------------------
Global Accel at story Centroids:(average) Ax Ay Ar
Story--1: 8.247387e-001 9.865127e-017 2.810327e-010

Building Damage index calculated based on Hysteretic elements:
Local Maximum Results----------------
Shear elements results:

For story 1
Wall Max Drift Max Force Energy Dissipation Damage index
St1W1: 1.267323e+000 3.076035e+003 8.260148e+003 8.239350e-001
St1W2: 5.667753e-010 4.107950e-006 2.013470e-016 1.686831e-010
St1W3: 1.267323e+000 3.076035e+003 8.260148e+003 8.239350e-001
St1W4: 5.667754e-010 4.107949e-006 2.013477e-016 1.686832e-010


I really don't know how to do that (I know how to read a simple excel file, or how to read a *.txt file that only contains numbers, but really got into trouble with reading that specific number in a mixed file, and also don't know how to use a 'for' loop that reads all the 1998 files for me!). So, could any of you do me a favor and help me with this please (a sample file is also attached below. Please note that the suffix is *.gen but I use notepad to read these files)?!

Thanks a lot

This post has been edited by Ameri: 10 October 2015 - 09:38 AM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1