ikarosilva / wfdb-app-toolbox

The WFDB Toolbox for MATLAB/Octave is a collection of functions for reading, writing, and processing physiologic signals in the formats used by PhysioNet (see README for details).
http://physionet.org/physiotools/matlab/wfdb-app-matlab/
GNU General Public License v3.0
92 stars 45 forks source link

WFDB_PATH not loaded from environment #149

Open achuthpv opened 6 years ago

achuthpv commented 6 years ago

wfdbloadlib.m, which is supposed to load WFDB libraries and set configurations, is currently not looking for environment variable "WFDB" in Octave/MATLAB. So, its value always get defaulted to if(isempty(WFDB_PATH)) tmpCache=[config.MATLAB_PATH '..' filesep 'database' filesep]; WFDB_PATH=['. ' tmpCache ' http://physionet.org/physiobank/database/']; end as WFDB_PATH is set as empty at the beginning of wfdbloadlib.m.

Wouldn't it be better to start with WFDB_PATH=getenv("WFDB"); and then set defaults if it is empty. This would give anyone the flexibility to point the path to desired database folders at the beginning of code execution without going through the hassle of editing the toolbox files.

I am using release 0-10-0, with Octave and Ubuntu 14.04.

jcbsv commented 6 years ago

In the previous version(s) you could supply a full path with the record-name and it worked without the need for defining a search path. I prefer the behavior of the previous version(s).

jcbsv commented 6 years ago

A temporary fix that enables loading of data files from a local path is to set WFDB_PATH = [' ']; in wfdbloadlib.m.

achuthpv commented 6 years ago

You can always set environment variable like WFDB_PATH using setenv() from within Octave/Matlab code/script. The good thing about it is that, based upon requirement it is very easy to write in script the way one can pass the record name. Just as @jcbsv mentioned in this comment, you can set WFDB_PATH as ' ' (space in single quotes) when required to pass full file path. For a person who doesn't require any of this, WFDB_PATH would usually be unset. In such cases, the default can be taken. Problem right now is that, if any modification has to be done for the way the records are accessed, it has to be done within the plugin and depending upon different requirements it has to be changed manually every single time.