×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how to get data from this type of file format

how to get data from this type of file format

how to get data from this type of file format

(OP)
I want to read the values from a file which is the following format into a matrix

@ STAGE_X_MIRROR
No   0    Pos_y     -234mm     Wx       10     Wxp        3
No   1    Pos_y     -232mm     Wx        8     Wxp        2
No   2    Pos_y     -230mm     Wx        8     Wxp        2
No   3    Pos_y     -228mm     Wx        8     Wxp        2
@ STAGE_Y_MIRROR
No   0    Pos_x     -164mm     Wy      -32     Wyp       -2
No   1    Pos_x     -162mm     Wy      -35     Wyp       -2
No   2    Pos_x     -160mm     Wy      -34     Wyp       -2
No   3    Pos_x     -158mm     Wy      -33     Wyp       -2

I need only the values Pos_y, Wx and Wxp and the next will be Pos_x, Wy and Wyp. That is the output of the matrices should be

matrix 1

-234 10 3
-232  8 2
-230  8 2

matrix 2

-164 -32 -2
-162 -35 -2

i coded to read from the file skip the first line then i said

data(iData,1:3) = sscanf(strLine,'%*s %*d %*s %g %*s %d %*s %d')'; - by this statement it was reading -234 in all the three.

please inform me if someone can do this even by anyother possible way also

RE: how to get data from this type of file format

(OP)
i even used
data(iData,1:3) = sscanf(strLine,'%*s %*d %*s %s %*s %d %*s %d')'     But its showing error.

even
data(iData,1) = sscanf(strLine,'%*s %*d %*s %g %*s %*d %*s %*d')';
        data(iData,2:3) = sscanf(strLine,'%*s %*d %*s %*g %*s %d %*s %d')';

this didnt work out

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources