Author Topic: read number in specific point in text file  (Read 1865 times)

Offline mule

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
read number in specific point in text file
« on: April 22, 2010, 09:39:57 AM »
assume that i have a text file.
this file contain combination of numbers and words.
i want to obtain a number in specific row and column of this file.
who can help me?

Offline sahuhk

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: read number in specific point in text file
« Reply #1 on: April 25, 2010, 09:21:25 AM »
Recently I came across a similar situation where I had to read numbers from a text file containing four columns, the first column was the name of thirty six each of three different elements, Cu, N and C. The other three columns were their position coordinates.


What I did is the following: In the MATLAB command window I first declared some values, Cu=29, N=7 and C=6.


Then I highlighted the contents of the text file and in the MATLAB command window gave the line var = [ CtrlV ] and entered.


Now I got a variable called var which is a four column array of which I wanted the last three columns for my further analysis. It was easy.


May be, this or a similar trick will help you.

Offline England90

  • Jr. Member
  • *
  • Posts: 15
  • Matlab Forum
    • View Profile
Re: read number in specific point in text file
« Reply #2 on: October 25, 2010, 05:06:32 PM »
Thanks for this math!

Matlab and SimuLink Development Forum

Re: read number in specific point in text file
« Reply #2 on: October 25, 2010, 05:06:32 PM »