Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1086
Number of posts: 1767

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

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
Report
Re: MATLAB LOADING DATA FROM A .TXT FILE Posted by lalaounisjacob on 25 Nov 2009 at 9:55 AM
Hello

I have a problem in matlab. I would like to read a .txt file like this
5) 3 368ms
6) 1
7) 6
8) 1
9) 4
10) 1 *
11) 6 *
12) 1 *
13) 2
14) 1
15) 6 410ms


the problem is that the data i want to read and write them in another file (only the third column) and in the third column where there is a space to write 0 and where is * to put -1 and from 410ms to keep only 410, the number.

Please help,
I am trying one week now




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 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.
Operated by CommunityHeaven, a BootstrapLabs company.