function write_linux
Error in using function write_linux. Can't write data back to a binary file.
% using N-MNIST
filename = '00004.bin';
TD = Read_Ndataset(filename);
Show3D(TD);
filename = '11111.bin';
write_linux(TD, filename);
TD = Read_Ndataset(filename);
Show3D(TD);


The names of the different formats are a bit confusing, but here's an explanation: The datasets use a format optimized for the dataset resolution to reduce file sizes. You can read a dataset file using the "Read_Ndataset()" function as you have done. You can write the "linux" format using "write_linux()", but this is not the same as the dataset format. To read the "linux" format you need to use the "read_linux()" function.
Thanks for reply. I read a dataset file using the Read_Ndataset() function and done some modification. I would like to convert back to dataset format same as N-MNIST .bin files.
For this you'd need to make your own function which reverses the format of "Read_Ndataset.m". I haven't had access to matlab in years, so I cannot test it, but it would look something like this:
function write_Ndataset(TD, filename)
evtStream = uint8(length(TD.x)*5);
evtStream(1:5:end) = TD.x-1; evtStream(2:5:end) = TD.y-1; evtStream(3:5:end) = bitshift(TD.p-1,7) + bitand(bitshift(TD.ts,-16), 127); evtStream(4:5:end) = bitand(bitshift(TD.ts, -8), 255); evtStream(5:5:end) = bitand(TD.ts, 255);
evtFile = fopen(filename, 'w'); fwrite(evtFile,evtStream,'uint8'); fclose(evtFile);
return