-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem: When executing the program main.m MatLab when we try to process long-duration audio files, it throws the following error:
Dot indexing is not supported for variables of this type.
While trying to execute the line
inaddr = cellfun(@(x) x.getAddresses(), packet_buffer, 'un', 0);
At the playAndRecord.m file.
Debugging: In order to debug the code the following lines have been added:
% --- Debugging to understand long-duration audio processing problems ---
% Finding indexes of elements whose types are not AEPacketRaw class
correctElements = cellfun(@(x) isa(x, 'net.sf.jaer.aemonitor.AEPacketRaw'), packet_buffer, 'un', 0);
correctElements = cell2mat(correctElements);
%test = all(correctElements);
%test
zeroindex = find(~correctElements);
zeroindex
% Printing the length of the original full packet_buffer cell array
length(packet_buffer)
During debugging we can see how a large number of elements of the packet_buffer variable are empty arrays.
Solution: In order to fix this, we could eliminate these packet_buffer elements which do not contain any information, after which it would be possible to call the function getAddresses(). The following code line allows to do this:
% --- Solving long-duration audio processing problems ---
packet_buffer = packet_buffer(~cellfun('isempty', packet_buffer));
However, these empty arrays are uselessly stored in memory. Improved code could save memory and time.