Thread Subject: MATLAB LOADING DATA FROM A .TXT FILE

Subject: MATLAB LOADING DATA FROM A .TXT FILE

From: Roberto Barrenechea

Date: 31 Oct, 2009 22:16:53

Message: 1 of 4

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

Subject: MATLAB LOADING DATA FROM A .TXT FILE

From: Wolfgang Schwanghart

Date: 1 Nov, 2009 17:32:03

Message: 2 of 4

Hi Roberto,

read the documentation for the function dlmwrite. dlmwrite does exactly what you are looking for.

Best regards,
Wolfgang


Roberto Barrenechea <rcbarrenechea@gmail.com> wrote in message <891247323.146526.1257027443558.JavaMail.root@gallium.mathforum.org>...
> 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

Subject: MATLAB LOADING DATA FROM A .TXT FILE

From: Wolfgang Schwanghart

Date: 1 Nov, 2009 17:34:02

Message: 3 of 4

Did I say dlmwrite? It's dlmread, of coarse...

Roberto Barrenechea <rcbarrenechea@gmail.com> wrote in message <891247323.146526.1257027443558.JavaMail.root@gallium.mathforum.org>...
> 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

Subject: MATLAB LOADING DATA FROM A .TXT FILE

From: dpb

Date: 1 Nov, 2009 18:14:17

Message: 4 of 4

Wolfgang Schwanghart wrote:
> Did I say dlmwrite? It's dlmread, of coarse...
...

Of course it is... (g,d&r... :) )

--

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com