Hello
I am trying to open a .spf2 file with matlab,but am having trouble. How can I do this?
Thank you Sam

Respuestas (2)

Walter Roberson
Walter Roberson el 24 de Oct. de 2016

0 votos

MATLAB does not offer any built-in support for .spf2 files, and there do not appear to be any File Exchange contributions for them.
What are the files? Are they to do with DNS tables? Are they to do with Still Picture Interchange File Format ?
Damiano Genovese
Damiano Genovese el 13 de Dic. de 2018

0 votos

Hi, I also have the same trouble. I'd like to read spectra saved as spf2 files.
spf2 files are the binary files of spectra saved from Thorlabs software for their spectrometers.
I attach an example of spf2 file in the zip folder, if anyone could take a look...
This is what the say in their manual (not sure it can be of any help):
Spectrum File Formats
The Thorlabs OSA software uses a variety of file formats in order to record measurement results.
*.spf2: This is the internal file format to save and load spectrum files from one or more traces. The file header consists of information about the used spectrometer, it's s/n, acquisition settings and trace properties

4 comentarios

Walter Roberson
Walter Roberson el 13 de Dic. de 2018
I do not seem to be finding any information about the internal file format. If we had the .csv of the same file it might be possible to figure out where the data starts.
Damiano Genovese
Damiano Genovese el 14 de Dic. de 2018
Dear Walter, thank you so much for your kind help. Attached is the same spectrum saved as spf2 and csv. Hope it can help.
Walter Roberson
Walter Roberson el 17 de Dic. de 2018
%experimental code
filename = '1.spf2';
fid = fopen(filename);
fseek(fid, 524, 'bof');
Length = fread(fid, 1, 'uint32'); %file stores little-endian
fseek(fid, -Length*4*2,'eof'); %4 bytes per entry, 2 columns
data = reshape( fread(fid, '*single'), [], 2); %file stores little-endian
fclose(fid);
I cannot promise that the length will definitely be at offset 524 in the file.
Damiano Genovese
Damiano Genovese el 17 de Dic. de 2018
Thank you, it's working well for my datasets!

Iniciar sesión para comentar.

Categorías

Más información sobre Audio Processing Algorithm Design en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Oct. de 2016

Comentada:

el 17 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by