title: Opencv: Unable to correctly read/write from/to using OpenCV from a text file?
body: <p>System info:  windows 7, 32 bit, opencv 2.4.10, msvs 2010   </p>
  
  <p>I have a text file having some integer values. 
  I want to read these values in a Mat object m, and then print out on the console. </p>
  
  <p>What I tried so far is this:</p>
  
  <pre><code>int main()
   {
  
  Mat m;
  /// read:
   FileStorage fs("myfile.txt",FileStorage::READ);
  
  if (!fs.isOpened()) {std::cout &lt;&lt; "unable to open file storage!" &lt;&lt; std::endl; return 0;}
  
  fs["mat1"] &gt;&gt; m;
  
  cout &lt;&lt; "mat1 = "&lt;&lt; endl &lt;&lt; " "  &lt;&lt; m &lt;&lt; endl &lt;&lt; endl;
  
  
  
  return 0;
  
  }
  </code></pre>
  
  <p>However  this prints ;</p>
  
  <blockquote>
    <p>mat1 =  []</p>
  </blockquote>
  
  <p>the actual data in the file is:</p>
  
  <pre><code>123456
  123456
  </code></pre>
  
  <p>So kindly help me understand what is wrong here. </p>
  
  <p><strong>Update</strong>
  I even tried mytext.xml by simply renaming the .text file. But still I see empty matrix as the out above. </p>
  
  <p>Oh so  the file is not opening as the output is:</p>
  
  <blockquote>
    <p>unable to open file storage!</p>
  </blockquote>