1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

read matrix input file and store it in matrix

Discussion in 'Java' started by shima, Apr 16, 2009.

  1. shima

    shima New Member

    hi,

    i having problem in reading input value in matrix form and store it in matrix.

    below is a sample of my input file (ref.txt)

    A1 A2 A3 A4 A5 A6 A7 A8
    q1 1 0 0 1 0 1 1 0
    q2 0 1 1 0 1 0 0 0
    q3 0 0 0 1 0 0 1 1
    q4 0 1 0 0 0 1 0 1
    q5 1 0 0 0 0 0 1 0
    q6 0 0 1 0 1 0 0 1

    how should i read this kind of input???
     
  2. asadullah.ansari

    asadullah.ansari TechCake

    take two loop one is for row means end of file and other is for column means end of line...
    and skip white space(according to your text file)...
    Example:
    Code:
    for i=0 to EOF
       for j=0 to EOL
             Skip according to your file which character  you have to skip menas like white space
             Mat[i][j]= read contents by file Pointer
     

Share This Page