EDF writing – error when using cell array as signal DATA
Hello 🙂
I would like to do a edf file entering my signals from a cell array (bin of time x EEG channels). Into each cells I have a vector containting 1000 values (mV across time). See picture:
However, I do get a very surprising error :
Error using signal.internal.edf.write.validateSignalData
Expected input to be a vector.
Error in signal.internal.edf.write.getFileCreateOpts>checkSignals (line 223)
signal.internal.edf.write.validateSignalData(sigData, …
Error in signal.internal.edf.write.getFileCreateOpts>createHdr (line 96)
[reqhdr, sigData] = checkSignals(reqhdr, sigData, tNumSignals);
Error in signal.internal.edf.write.getFileCreateOpts>createAndValidateHeader (line 47)
[hdr, sigData, tsal] = createHdr(thdr, sigData, tsal, hdrPropertiesList, …
Error in signal.internal.edf.write.getFileCreateOpts (line 13)
[hdr, sigData, tsal] = createAndValidateHeader(hdr, sigData, tsal, …
Error in edfwrite/createFile (line 1620)
signal.internal.edf.write.getFileCreateOpts(hdr, signalData, …
Error in edfwrite (line 499)
[obj, fileInfo] = createFile(obj, filename, hdr,…
It comes from this function in Matlab "source" code (function : validateSignalData ligne: 15):
validateattributes(signalData, {‘cell’}, {‘vector’});
I did check several times : Inside of each cells, I have a vector.
If I write :
isvector(data_cell{1,1})
ans =
logical
1
Valide for all cells
But if I ask :
validateattributes(data_cell, {‘cell’}, {‘vector’})
Expected input to be a vector.
Am I missing something because I do not see why my cell array would not have a vector attribute inside ?
My code when creating data_cell:
data_cell = {};
for nb_sig = 1: hdr.NumSignals
for time = 1:floor(length(LFP(1,:))/srate) % in sec
startpoint = ((time-1)*srate+1);
stoppoint = ((time-1)*srate+1) + srate;
temp_vect = LFP(nb_sig,startpoint:stoppoint);
data_cell{time, nb_sig} = temp_vect’;
end
end
file_EDF_name = "R005_S1_V4.edf";
edfw = edfwrite(fullfile(pahtway_saving,file_EDF_name),hdr,data_cell);
Link for necessary variables :
https://seafile.unistra.fr/f/f102cbe386824199a6fe/?dl=1Hello 🙂
I would like to do a edf file entering my signals from a cell array (bin of time x EEG channels). Into each cells I have a vector containting 1000 values (mV across time). See picture:
However, I do get a very surprising error :
Error using signal.internal.edf.write.validateSignalData
Expected input to be a vector.
Error in signal.internal.edf.write.getFileCreateOpts>checkSignals (line 223)
signal.internal.edf.write.validateSignalData(sigData, …
Error in signal.internal.edf.write.getFileCreateOpts>createHdr (line 96)
[reqhdr, sigData] = checkSignals(reqhdr, sigData, tNumSignals);
Error in signal.internal.edf.write.getFileCreateOpts>createAndValidateHeader (line 47)
[hdr, sigData, tsal] = createHdr(thdr, sigData, tsal, hdrPropertiesList, …
Error in signal.internal.edf.write.getFileCreateOpts (line 13)
[hdr, sigData, tsal] = createAndValidateHeader(hdr, sigData, tsal, …
Error in edfwrite/createFile (line 1620)
signal.internal.edf.write.getFileCreateOpts(hdr, signalData, …
Error in edfwrite (line 499)
[obj, fileInfo] = createFile(obj, filename, hdr,…
It comes from this function in Matlab "source" code (function : validateSignalData ligne: 15):
validateattributes(signalData, {‘cell’}, {‘vector’});
I did check several times : Inside of each cells, I have a vector.
If I write :
isvector(data_cell{1,1})
ans =
logical
1
Valide for all cells
But if I ask :
validateattributes(data_cell, {‘cell’}, {‘vector’})
Expected input to be a vector.
Am I missing something because I do not see why my cell array would not have a vector attribute inside ?
My code when creating data_cell:
data_cell = {};
for nb_sig = 1: hdr.NumSignals
for time = 1:floor(length(LFP(1,:))/srate) % in sec
startpoint = ((time-1)*srate+1);
stoppoint = ((time-1)*srate+1) + srate;
temp_vect = LFP(nb_sig,startpoint:stoppoint);
data_cell{time, nb_sig} = temp_vect’;
end
end
file_EDF_name = "R005_S1_V4.edf";
edfw = edfwrite(fullfile(pahtway_saving,file_EDF_name),hdr,data_cell);
Link for necessary variables :
https://seafile.unistra.fr/f/f102cbe386824199a6fe/?dl=1 Hello 🙂
I would like to do a edf file entering my signals from a cell array (bin of time x EEG channels). Into each cells I have a vector containting 1000 values (mV across time). See picture:
However, I do get a very surprising error :
Error using signal.internal.edf.write.validateSignalData
Expected input to be a vector.
Error in signal.internal.edf.write.getFileCreateOpts>checkSignals (line 223)
signal.internal.edf.write.validateSignalData(sigData, …
Error in signal.internal.edf.write.getFileCreateOpts>createHdr (line 96)
[reqhdr, sigData] = checkSignals(reqhdr, sigData, tNumSignals);
Error in signal.internal.edf.write.getFileCreateOpts>createAndValidateHeader (line 47)
[hdr, sigData, tsal] = createHdr(thdr, sigData, tsal, hdrPropertiesList, …
Error in signal.internal.edf.write.getFileCreateOpts (line 13)
[hdr, sigData, tsal] = createAndValidateHeader(hdr, sigData, tsal, …
Error in edfwrite/createFile (line 1620)
signal.internal.edf.write.getFileCreateOpts(hdr, signalData, …
Error in edfwrite (line 499)
[obj, fileInfo] = createFile(obj, filename, hdr,…
It comes from this function in Matlab "source" code (function : validateSignalData ligne: 15):
validateattributes(signalData, {‘cell’}, {‘vector’});
I did check several times : Inside of each cells, I have a vector.
If I write :
isvector(data_cell{1,1})
ans =
logical
1
Valide for all cells
But if I ask :
validateattributes(data_cell, {‘cell’}, {‘vector’})
Expected input to be a vector.
Am I missing something because I do not see why my cell array would not have a vector attribute inside ?
My code when creating data_cell:
data_cell = {};
for nb_sig = 1: hdr.NumSignals
for time = 1:floor(length(LFP(1,:))/srate) % in sec
startpoint = ((time-1)*srate+1);
stoppoint = ((time-1)*srate+1) + srate;
temp_vect = LFP(nb_sig,startpoint:stoppoint);
data_cell{time, nb_sig} = temp_vect’;
end
end
file_EDF_name = "R005_S1_V4.edf";
edfw = edfwrite(fullfile(pahtway_saving,file_EDF_name),hdr,data_cell);
Link for necessary variables :
https://seafile.unistra.fr/f/f102cbe386824199a6fe/?dl=1 edf, edfwrite MATLAB Answers — New Questions
​