reading a file which contains text and number in matlab

Status
Not open for further replies.

hengam

Newbie level 4
Joined
Jul 25, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
37
Hi
I have a file which is like:

$DATA1 SOURCE='HSPICE' VERSION='D-2010.03 32-BIT'
.TITLE '* inverter'
index vdd vtp vtn
lgate power temper
alter#
1.0000 0.7500 -0.7100 0.3500
36.0000 -2.095e-16 0.
......
.....
which means it contains both number and text I just want the highlighted number and omit the others.
what can i do using matlab?
Thanks in advanced
 

Hi,

You can skip the text with fseek and then read the numbers. For instance:

f = fopen('filename.txt');
fseek(f, 122, 'bof');
A = fscanf(f,'%f',[2,4]);

Hope this will help
 
Reactions: hengam

    hengam

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…