{
  "id": 8256,
  "title": "Problems with freq and latency in Octave 3.8.1",
  "url": "/competitions/seizure-detection/discussion/8256",
  "author_name": "",
  "post_date": "2014-05-22T19:09:01.663Z",
  "votes": 1,
  "comment_count": 10,
  "views": 2290,
  "content": "<p>I've tried loading some of the .mat files in Octave 3.8.1. &nbsp;The data and channels variables look fine, but latency and freq seem to be empty matrices (1x0 matrices). &nbsp;Any suggestions?</p>\n<p>Is anyone using Octave having success getting at these two fields?</p>",
  "messages": [
    {
      "id": "46092",
      "postDate": "05/22/2014 19:09:01",
      "content": "<p>I've tried loading some of the .mat files in Octave 3.8.1. &nbsp;The data and channels variables look fine, but latency and freq seem to be empty matrices (1x0 matrices). &nbsp;Any suggestions?</p>\n<p>Is anyone using Octave having success getting at these two fields?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "46121",
      "postDate": "05/23/2014 13:21:11",
      "content": "<p>Same here, nothing in those matrices. &nbsp;My understanding is that it should be for ictal entries.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "46137",
      "postDate": "05/23/2014 16:29:07",
      "content": "<p>Jeffrey is right - latency is only in ictal entries (the training files).</p>\n<p>If it helps, output from MATLAB is shown below for three files.</p>\n\n<p>Good luck!</p>\n<p><code>&gt;&gt; d1_s1_1 = load('Dog_1_ictal_segment_1');<br>&gt;&gt; d1_s1_2 = load('Dog_1_ictal_segment_2');</code><code></code></p>\n<p><code>&gt;&gt; d1_s1_1</code></p>\n<p><code>d1_s1_1 =</code><code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]<br> latency: 0</code><code><br></code></p>\n<p><code>&gt;&gt; d1_s1_2</code></p>\n<p><code><code>d1_s1_2 =</code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]<br> latency: 1</code><code></code><code></code></p>\n<p><code>&gt;&gt; d1_s0_1 = load('Dog_1_interictal_segment_1.mat');</code></p>\n<p><code>&gt;&gt; d1_s0_1</code></p>\n<p><code>d1_s0_1 =</code><code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]</code></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "47081",
      "postDate": "05/26/2014 12:23:03",
      "content": "<p>I'm with Eric on this one. &nbsp;I did exactly what zeros showed in his post and there was nothing in freq or latency. &nbsp;It shows:</p>\n<p>freq = [](1x0)</p>\n<p>and&nbsp;</p>\n<p>latency = [](1x0)</p>\n<p>Channels and data has what it is supposed to. &nbsp;Any ideas?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "47092",
      "postDate": "05/26/2014 15:45:51",
      "content": "<p>Update: I just spent a few hours getting homebrew on my mac to install the latest ocatave 3.8.1 but it still doesn't have anything in any of the freq or latency values. &nbsp;Anyone having luck with other tools? &nbsp;Later today, I'll try reading the info with other tools and see if I get any luck.</p>\n<p>Would I be correct in assuming that if I were able to explode the data, it is probably not corrupt?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "47100",
      "postDate": "05/26/2014 18:46:47",
      "content": "<p>I switched to using R to read the data and that's been working for me. &nbsp;No problems with the latency or frequency fields. &nbsp;There's another post in the forum that describes the package you need - I think it's &quot;R.matlab&quot; or something.</p>\n<p>Jeffrey, there's no chance your issues (our issues) with latency and frequency are due to data corruption.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "47108",
      "postDate": "05/26/2014 23:37:18",
      "content": "<p>R did the trick! Eric, I really appreciate the help on this. &nbsp;It is very frustrating getting over the hurdles of big data, but WOW is it a fascinating subject. &nbsp;Hope I can help you out sometime.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49137",
      "postDate": "06/14/2014 10:51:11",
      "content": "<p>Hi,</p>\n<p>Same issue here.</p>\n<p>The issue might be&nbsp;with octave, but in any case it is useful to know with what version of matlab where the files created. Is it matlab v7 format?</p>\n<p>If you are using newer releases of matlab there are several datatypes that depend on classes (are latency and freq just doubles?). This of course makes compatibility quite difficult.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49168",
      "postDate": "06/15/2014 21:41:17",
      "content": "<p>Hi,</p>\n<p>It is indeed a bug in octave. The files were created using matlab format v5.</p>\n<p>Sadly, loading from v5 in Octave 3.8.1 seems to have a bug.</p>\n<p>If you still want to use Octave here is a workaround until the bug is fixed.</p>\n<p>Since scipy doesn't have this bug, if you are patient you can update all files to v7 format using the following python script</p>\n\n<p><code>from scipy.io import loadmat, savemat<br>from os import listdir<br>from os.path import isdir, isfile, join</code></p>\n<p><code>import sys</code></p>\n<p><code>mypath = &quot;clips&quot;</code></p>\n<p><code>folders = [ f for f in listdir(mypath) if isdir(join(mypath,f)) ]</code></p>\n<p><code>for folder in folders:<br>&nbsp; tmp = join(mypath,folder)<br>&nbsp; files = [ f for f in listdir(tmp) if isfile(join(tmp,f)) ]<br>&nbsp; </code></p>\n<p><code>&nbsp; for dataf in files:<br>&nbsp; &nbsp; thepath = join (tmp,dataf)<br>&nbsp; &nbsp; data = loadmat (thepath)<br>&nbsp; &nbsp; print thepath<br>&nbsp; &nbsp; savemat (thepath, data)<br>&nbsp; &nbsp; sys.stdout.flush()</code></p>\n\n<p>Be warned: this will take a while.&nbsp;</p>\n<p>After this Octave 3.8.1 reads all the content of the file correctly.</p>\n\n<p><strong>UPDATE:</strong></p>\n<p>If a file is saved in matlab with version 5 format; then &nbsp;Octave can read it without a problem.&nbsp;</p>\n<p>The issue is with v5 files created in R (which is the case for this data).&nbsp;</p>\n<p>However other read-from-file functions seem to do the trick (like python).</p>\n<p>We are working to fix this...</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49204",
      "postDate": "06/16/2014 15:21:25",
      "content": "<p>Wow, kakila, I have to give you major kudos! &nbsp;Thanks for being a team player and figuring that out.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "49208",
      "postDate": "06/16/2014 16:13:40",
      "content": "<p>The bug has been fixed.&nbsp;It will be part of the 3.8.2 bug fix release</p>\n\n<p>https://savannah.gnu.org/bugs/?42562</p>\n\n<p>It seems though it is a glitch in R, we will let them know</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 46121,
      "author_name": "jeffrichley",
      "author_url": "",
      "post_date": "05/23/2014 13:21:11",
      "content": "<p>Same here, nothing in those matrices. &nbsp;My understanding is that it should be for ictal entries.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 46137,
      "author_name": "asaini",
      "author_url": "",
      "post_date": "05/23/2014 16:29:07",
      "content": "<p>Jeffrey is right - latency is only in ictal entries (the training files).</p>\n<p>If it helps, output from MATLAB is shown below for three files.</p>\n\n<p>Good luck!</p>\n<p><code>&gt;&gt; d1_s1_1 = load('Dog_1_ictal_segment_1');<br>&gt;&gt; d1_s1_2 = load('Dog_1_ictal_segment_2');</code><code></code></p>\n<p><code>&gt;&gt; d1_s1_1</code></p>\n<p><code>d1_s1_1 =</code><code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]<br> latency: 0</code><code><br></code></p>\n<p><code>&gt;&gt; d1_s1_2</code></p>\n<p><code><code>d1_s1_2 =</code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]<br> latency: 1</code><code></code><code></code></p>\n<p><code>&gt;&gt; d1_s0_1 = load('Dog_1_interictal_segment_1.mat');</code></p>\n<p><code>&gt;&gt; d1_s0_1</code></p>\n<p><code>d1_s0_1 =</code><code>data: [16x400 double]<br> freq: 399.6098<br> channels: [1x1 struct]</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 47081,
      "author_name": "jeffrichley",
      "author_url": "",
      "post_date": "05/26/2014 12:23:03",
      "content": "<p>I'm with Eric on this one. &nbsp;I did exactly what zeros showed in his post and there was nothing in freq or latency. &nbsp;It shows:</p>\n<p>freq = [](1x0)</p>\n<p>and&nbsp;</p>\n<p>latency = [](1x0)</p>\n<p>Channels and data has what it is supposed to. &nbsp;Any ideas?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 47092,
      "author_name": "jeffrichley",
      "author_url": "",
      "post_date": "05/26/2014 15:45:51",
      "content": "<p>Update: I just spent a few hours getting homebrew on my mac to install the latest ocatave 3.8.1 but it still doesn't have anything in any of the freq or latency values. &nbsp;Anyone having luck with other tools? &nbsp;Later today, I'll try reading the info with other tools and see if I get any luck.</p>\n<p>Would I be correct in assuming that if I were able to explode the data, it is probably not corrupt?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 47100,
      "author_name": "onemillionmonkeys",
      "author_url": "",
      "post_date": "05/26/2014 18:46:47",
      "content": "<p>I switched to using R to read the data and that's been working for me. &nbsp;No problems with the latency or frequency fields. &nbsp;There's another post in the forum that describes the package you need - I think it's &quot;R.matlab&quot; or something.</p>\n<p>Jeffrey, there's no chance your issues (our issues) with latency and frequency are due to data corruption.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 47108,
      "author_name": "jeffrichley",
      "author_url": "",
      "post_date": "05/26/2014 23:37:18",
      "content": "<p>R did the trick! Eric, I really appreciate the help on this. &nbsp;It is very frustrating getting over the hurdles of big data, but WOW is it a fascinating subject. &nbsp;Hope I can help you out sometime.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49137,
      "author_name": "kakila",
      "author_url": "",
      "post_date": "06/14/2014 10:51:11",
      "content": "<p>Hi,</p>\n<p>Same issue here.</p>\n<p>The issue might be&nbsp;with octave, but in any case it is useful to know with what version of matlab where the files created. Is it matlab v7 format?</p>\n<p>If you are using newer releases of matlab there are several datatypes that depend on classes (are latency and freq just doubles?). This of course makes compatibility quite difficult.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49168,
      "author_name": "kakila",
      "author_url": "",
      "post_date": "06/15/2014 21:41:17",
      "content": "<p>Hi,</p>\n<p>It is indeed a bug in octave. The files were created using matlab format v5.</p>\n<p>Sadly, loading from v5 in Octave 3.8.1 seems to have a bug.</p>\n<p>If you still want to use Octave here is a workaround until the bug is fixed.</p>\n<p>Since scipy doesn't have this bug, if you are patient you can update all files to v7 format using the following python script</p>\n\n<p><code>from scipy.io import loadmat, savemat<br>from os import listdir<br>from os.path import isdir, isfile, join</code></p>\n<p><code>import sys</code></p>\n<p><code>mypath = &quot;clips&quot;</code></p>\n<p><code>folders = [ f for f in listdir(mypath) if isdir(join(mypath,f)) ]</code></p>\n<p><code>for folder in folders:<br>&nbsp; tmp = join(mypath,folder)<br>&nbsp; files = [ f for f in listdir(tmp) if isfile(join(tmp,f)) ]<br>&nbsp; </code></p>\n<p><code>&nbsp; for dataf in files:<br>&nbsp; &nbsp; thepath = join (tmp,dataf)<br>&nbsp; &nbsp; data = loadmat (thepath)<br>&nbsp; &nbsp; print thepath<br>&nbsp; &nbsp; savemat (thepath, data)<br>&nbsp; &nbsp; sys.stdout.flush()</code></p>\n\n<p>Be warned: this will take a while.&nbsp;</p>\n<p>After this Octave 3.8.1 reads all the content of the file correctly.</p>\n\n<p><strong>UPDATE:</strong></p>\n<p>If a file is saved in matlab with version 5 format; then &nbsp;Octave can read it without a problem.&nbsp;</p>\n<p>The issue is with v5 files created in R (which is the case for this data).&nbsp;</p>\n<p>However other read-from-file functions seem to do the trick (like python).</p>\n<p>We are working to fix this...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49204,
      "author_name": "jeffrichley",
      "author_url": "",
      "post_date": "06/16/2014 15:21:25",
      "content": "<p>Wow, kakila, I have to give you major kudos! &nbsp;Thanks for being a team player and figuring that out.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 49208,
      "author_name": "kakila",
      "author_url": "",
      "post_date": "06/16/2014 16:13:40",
      "content": "<p>The bug has been fixed.&nbsp;It will be part of the 3.8.2 bug fix release</p>\n\n<p>https://savannah.gnu.org/bugs/?42562</p>\n\n<p>It seems though it is a glitch in R, we will let them know</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "46092": "",
    "46121": "",
    "46137": "",
    "47081": "",
    "47092": "",
    "47100": "",
    "47108": "",
    "49137": "",
    "49168": "",
    "49204": "",
    "49208": ""
  },
  "source": "meta"
}