Why does the function call "function [hdr, record] = edfReadOddur( 'tinnaprim​e.edf',var​argin )" give an error?

2 Ansichten (letzte 30 Tage)
This is the error message:
Error: File: edfReadOddur.m Line: 1 Column: 40 Unexpected MATLAB expression.

Akzeptierte Antwort

Geoff Hayes
Geoff Hayes am 25 Jul. 2017
Oddur - if your function signature (the first line in edfReadOddur.m) is written as
function [hdr, record] = edfReadOddur( 'tinnaprime.edf',varargin )
then the problem is that you are trying to set the first parameter of your function as a string rather than as an input parameter/variable. Your signature should be defined as
function [hdr, record] = edfReadOddur( filename, varargin)
and you would call the above (from the command line or another piece of code) and pass in 'tinnaprime.edf' to populate/set the filename parameter
>> edfReadOddur('tinnaprime.edf')
See Function Basics for more details.
  3 Kommentare
Geoff Hayes
Geoff Hayes am 26 Jul. 2017
Oddur - from edfRead at FEX, the function signature is
function [hdr, record] = edfread(fname, varargin)
so it isn't clear to me why you think that it should be
function [hdr, record] = edfRead('tinnaprime.edf', varargin)
You would call this function as
[hdr, record] = edfRead('tinnaprime.edf)
(perhaps passing more input variables as described along with this FEX submission.
As for the error, No such file or directory, try passing the full path and file name as the input parameter to edfRead.
Oddur Bjarnason
Oddur Bjarnason am 26 Jul. 2017
Again I tried to take your suggestions into account. I used the following function signature:
function [hdr, record] = edfReadUntilDone(tinna, varargin)
I called the function with:
edfReadUntilDone('C:\Users\Oddur\Documents\Emotiv Files\Tinna\tinnaprime.edf')
I got the following answer:
ans =
struct with fields:
ver: 0
patientID: 'tinna '
recordID: '2 '
startdate: '01.05.16'
starttime: '20.18.56'
bytes: 10496
records: 636
duration: 1
ns: 40
label: {1×40 cell}
transducer: {1×40 cell}
units: {1×40 cell}
physicalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
physicalMax: [1×40 double]
digitalMin: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
digitalMax: [1×40 double]
prefilter: {1×40 cell}
samples: [1×40 double]
frequency: [1×40 double]
From this I gather that the file has been loaded. I do unfortunately not get any data records.
The original question that I posed has now been answered so I shall accept your answer. The rest of the problems I have with the function I shall take up with Brett.
Thank you.
Oddur

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by