title: Access database in Physionet's ptbdb by Matlab
body: <p>I set up the system first by</p>
  
  <pre><code>[old_path]=which('rdsamp');if(~isempty(old_path)) rmpath(old_path(1:end-8)); end
  wfdb_url='http://physionet.org/physiotools/matlab/wfdb-app-matlab/wfdb-app-toolbox-0-9-3.zip';
  [filestr,status] = urlwrite(wfdb_url,'wfdb-app-toolbox-0-9-3.zip');
  unzip('wfdb-app-toolbox-0-9-3.zip');
  cd mcode
  addpath(pwd);savepath
  </code></pre>
  
  <p>I am trying to read databases from <a href="http://www.physionet.org/" rel="nofollow">Physionet</a>.
  I have successfully reached one database <em>mitdb</em> by</p>
  
  <pre><code>[tm,sig]=rdsamp('mitdb/100',1)
  </code></pre>
  
  <p>but I want to reach the database <a href="http://www.physionet.org/physiobank/database/ptbdb/" rel="nofollow">ptbdb</a> unsuccessfully by</p>
  
  <pre><code>[tm,sig]=rdsamp('ptbdb/100',1)
  </code></pre>
  
  <p>and get the error</p>
  
  <pre><code>Warning: Could not get signal information. Attempting to read signal without buffering. 
  &gt; In rdsamp at 107 
  Error: Cannot convert to double: 
  init: can't open header for record ptbdb/100
  Error using rdsamp (line 145)
  Java exception occurred:
  java.lang.NumberFormatException: Cannot convert
      at org.physionet.wfdb.Wfdbexec.execToDoubleArray(Unknown Source)
  </code></pre>
  
  <p>The first error message refers to these lines in <em>rdsamp.m</em>:</p>
  
  <pre><code>if(isempty(N))
      [siginfo,~]=wfdbdesc(recordName);
      if(~isempty(siginfo))
          N=siginfo(1).LengthSamples;
      else
          warning('Could not get signal information. Attempting to read signal without buffering.')
      end
  end
  </code></pre>
  
  <p>This line <code>if(~isempty(siginfo))</code> is false means that the <strong>siginfo</strong> is empty that is there is no signal. <strong>Why?</strong> No access to the database, I think.
  I think other errors follow from it.
  So the error must follow from this line</p>
  
  <pre><code>[siginfo,~]=wfdbdesc(recordName);
  </code></pre>
  
  <p><strong>What does the snake mean here in the brackets?</strong></p>
  
  <p><strong>How can you get data from ptbdb by Matlab?</strong></p>
  
  <p>So</p>
  
  <p><strong>Does this error mean that the connection cannot be established to the database?</strong>
  or
  <strong>that there does not exists such data in the database?</strong></p>
  
  <p>It would be very nice to know how you can check if you have connection to the database like in Postrgres. It would be much easier to debug.</p>