Read from text file and write in matrix

1 vue (au cours des 30 derniers jours)
Hamid Reza Barzegar
Hamid Reza Barzegar le 23 Déc 2015
Commenté : Walter Roberson le 23 Déc 2015
I have a different kind of text file which is positions of matrices and i want to convert it to binary spars matrix .
how should i read from this text file ?
because each number is for different structure
Example:
12 16
4 3
4 4 4 4 4 4 4 4 4 4 4 4
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 8 10 13
4 7 9 13
2 5 7 10
4 6 11 14
3 9 15 16
1 6 9 10
4 8 12 15
2 6 12 16
1 7 14 16
3 5 12 14
2 11 13 15
1 5 8 11
6 9 12
3 8 11
1 5 10
2 4 7
3 10 12
4 6 8
2 3 9
1 7 12
2 5 6
1 3 6
4 11 12
7 8 10
1 2 11
4 9 10
5 7 11
5 8 9
12 and 16 are size of the matrix
4 and 3 are number of 1 in spars matrix
then position of 1 in column and vector
  2 commentaires
Walter Roberson
Walter Roberson le 23 Déc 2015
I do not understand your description. Please show us how the first couple of rows would convert to output.
Walter Roberson
Walter Roberson le 23 Déc 2015
It looks like the first line defines a list of matrix row sizes, that there will be one matrix generated for every number on the first line. I cannot tell if the matrices are intended to be square.
I do not understand the purpose of the second line.
Lines 3 and 4 (and probably one line for every matrix implied by the first line) appear to be lists of the number of 1's in each row for each respective matrix. 12 entries for 12 rows, 16 entries for 16 rows.
After that there appears to be a row of indices for each row in the first matrix, with the indices showing where the 1's are to be. The number for any one line matches the number for the line from row 3.
After that there appears to be a row of indices for each row in the second matrix, with the indices showing where the 1's are to be. The number for any one line matches the number for the line from row 4.
Line 2 might have some meaning if it is required that the number of 1's is the same in each row of one of the matrices, in which case it lists the number for each matrix, with the information on lines 3 and 4 being redundant ? Or perhaps it is the maximum number of 1's in a row, which would be redundant, easily calculated from rows 3 and 4 ?

Connectez-vous pour commenter.

Réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by