Check out and contribute to CodePedia, the wiki for developers.

Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 553
Number of posts: 954

This Forum Only
Post New Thread

Report
MATLAB LOADING DATA FROM A .TXT FILE Posted by rcbarrenechea on 31 Oct 2009 at 3:37 PM
MATLAB LOADING DATA FROM A .TXT FILE?

Please I need some help with this to finish my thesis.

I tried to load the solution.txt file in MATLAB, but i have been
unable to do it because it sais that there is a format problem
with the first rows, however i only need to load the rows 6 to 9 from the file
wich have a recognazible format and can be loaded with the textread function

The solution.txt file has the following data:

OBJECTIVE FUNCTION VALUE

1) 3942307.

VARIABLE VALUE REDUCED COST
UI001 0.02 -96876.960938
UI002 0.06 359612.000000
UI003 0.01 392966.000000
UI004 0.05 392966.000000

ROW SLACK OR SURPLUS DUAL PRICES
2) 0.000000 -30.976025


I only need to load rows 6 to 9, without changing in any way the solution.txt file.
The data i need would be:

UI001 0.02 -96876.960938
UI002 0.06 359612.000000
UI003 0.01 392966.000000
UI004 0.05 392966.000000

Could someone please tell me what function can i use to load the solution.txt file
but delimited only to the rows 6 to 9?

Thank you

Report
Re: MATLAB LOADING DATA FROM A .TXT FILE Posted by jjasso5 on 31 Oct 2009 at 5:30 PM
use the parameter 'headerLines' within the textscan function.

For example:

data1 = textscan(fopen(...), '%f %f %f', 'headerLines', 6)
The '6' means to skip the first 6 lines.



Learn Matlab here!
http://www.matrixlab-examples.com



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.