Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: URGENT: Read text file and save matrices
Date: Mon, 13 Oct 2008 22:30:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 84
Message-ID: <gd0i5s$abm$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1223937020 10614 172.30.248.35 (13 Oct 2008 22:30:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Oct 2008 22:30:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1551459
Xref: news.mathworks.com comp.soft-sys.matlab:494974


Hey guys I want to be able to read a bunch of files with the following type of structure but they all have different data dimensions.

3
10

81 79 85 
97 91 75 
60 98 79 
56 74 74 
64 86 90
59 98 74
53 56 50
90 76 68 
53 57 60 
73 72 62

69 74 75 62 76 55 67 55 78 96
69 79 69 97 53 59 72 76 54 56
89 78 91 72 59 52 92 96 95 95
74 98 99 68 55 69 66 76 52 92
81 79 85 97 91 75 60 98 79 56 
74 74 64 86 90 59 98 74 53 56 
50 90 76 68 53 57 60 91 75 60 
89 78 91 72 59 52 92 96 95 95
74 98 99 68 55 69 66 76 52 92
81 79 85 97 91 75 60 98 79 56

74 49 64 86 90 59 98 74 53 56 
50 90 76 68 53 57 60 91 75 60 
89 78 91 72 59 52 92 96 95 95
74 98 99 68 55 69 66 76 52 92
81 79 85 97 91 75 60 98 79 56
69 74 75 62 76 55 67 55 78 96
69 79 69 97 53 59 72 76 54 56
89 78 91 72 59 52 92 96 95 95
74 98 99 68 55 69 66 76 52 92
81 79 85 97 91 75 60 98 79 56 

74 74 64 86 90 59 98 74 53 56 
50 90 76 68 53 57 60 91 75 60 
89 78 91 72 59 52 92 96 95 95
81 79 85 97 91 75 60 98 79 56
69 74 75 62 76 55 67 55 78 96
69 79 69 97 53 59 72 76 54 56
50 90 76 68 53 57 60 91 75 60 
89 78 91 72 59 52 92 96 95 95
74 98 99 68 55 69 66 76 52 92
81 79 85 97 91 75 60 98 79 56


So let me explain what this means. First the 3 and 10 means 3 machines (m) and 10 jobs (n). I want to be able extract this and save it as a variable.

Then the next block shows the processing times of n number of jobs at m number of machines. I also want to put this in a variable.

After that there are m blocks of data (3 in this case) with a matrix of nxn representing setup times at each machine. I want to be able to save each of these blocks in a different variable each.

Basically I want it to show this:

A = [3 10]

PT = [81 79 85 
      97 91 75 
      60 98 79 
      56 74 74 
      64 86 90
      59 98 74
      53 56 50
      90 76 68 
      53 57 60 
      73 72 62]

ST1 = [69 74 75 62 76 55 67 55 78 96
       69 79 69 97 53 59 72 76 54 56
       89 78 91 72 59 52 92 96 95 95
             .
             .
             .
       81 79 85 97 91 75 60 98 79 56]

ST2 = [....]

All my files will have a different number of machines and jobs so I want MATLAB to be able to read this automatically.

ANY help is appreciated! Thank you so much and please try it!