Hello guys!
I am working as a physicist with matlab.
I am not sure if it is necessary, but here is the code I use:
Code
clear;
clc;
autofit_start_wl = 640;
autofit_stop_wl = 765;
[wl, spectra] = my_importfile_spectra('\\file\e24\Projects\FinleyLab\_IQPGroup\_plasmon WG\Samples\S2\S2.8\2015-10-21 Detection Scans\19-Spectral Piezo Scan along WG1 HeNe 1.2mW -5...1..5 .5s .1_spectra.dat', 3, 1029);
autofit_start = find(wl <= autofit_stop_wl, 1);
autofit_stop = find(wl >= autofit_start_wl, 1, 'last');
fitdata = fitAllSpectra(wl(autofit_start:autofit_stop), ...
spectra(autofit_start:autofit_stop, :), [800 1500 1000 2 4 745 760]);
fit_backgrounds = fitdata(:, 3);
laser_center_wl = zeros(size(spectra, 2), 1);
laser_int = zeros(size(spectra, 2), 1);
laser_start = size(spectra, 1);
laser_wl = wl(autofit_stop:laser_start);
laser_spectra = spectra(autofit_stop:laser_start, :);
for i=1:size(laser_spectra, 2)
spectrum = laser_spectra(:, i) - fit_backgrounds(i);
laser_int(i) = sum(sum(spectrum));
laser_center_wl(i) = 1/laser_int(i) * laser_wl' * spectrum;
end
clear i spectrum laser_wl laser_start laser_spectra autofit_*
plotend = numel(laser_int);
scatter(1:plotend,fitdata(:,8))
What is this code doing?
Basically it about a double-gaussian fit of a spectrum, but who cares^^
My "needs"This code creates several variables. I need a few of them being written in a .dat or .txt file including a description of what they are, so that I can import them into origin for further analysis.
Basically I need in one textfile:
fitdata - a 101x8 double
laser_int - a 101x1 double
laser_center_wl - a 101x1 double
I just started using matlab and was used to seperatly safe those values in a .dat file via matlab itself, but this gets really annoying if you have alot of data!
thanks in advance