function MTT_example(file_name) %%% Basic examples showing how to recover MTT output results %%% to plot each trace and to build the histogram %%% of fluorescence intensities if nargin<1 % no file_name provided? files = dir('*.stk'); if isempty(files), disp('no data in current dir'), return, end file_name = files(1).name; % default: first stk file disp(['using' file_name 'by default']) end file_param = [file_name '_tab_param.dat']; % output file %% Load data cd('output23') % or ('output22'), according to version used % Disclaimer: version 2.2 only generates 7 parameters, % an extra parameter, noise, was added in version 2.3 % To read all parameters at once, in a single table % tab_param = fread_all_param(file_param); % tab_i = tab_param(2:8:end, :); tab_j = ... % To read all parameters (except frame_number) in separate tables % [tab_i,tab_j,tab_alpha,tab_radius,tab_offset,tab_blk,tab_noise] = fread_all_data_spt(file_param); tab_i = fread_data_spt(file_param, 3); % index is 3 because trace number & frame number, non informative, are discarded! tab_j= fread_data_spt(file_param, 4); tab_alpha = fread_data_spt(file_param, 5); tab_blk = fread_data_spt(file_param, 8); %% Loop over traces N_traces = size(tab_i,1); % Tables are N_traces lines by N_frames colums for itrc = 1:N_traces No_blk_index = tab_blk(itrc, :)>0; % non blinking steps only plot(tab_i(itrc, No_blk_index), tab_j(itrc, No_blk_index)) xlabel('i (pixel)'), ylabel('j (pixel)') title(['trace # ' num2str(itrc)]) disp('Please strike any key for next trace'), pause end %% Fluo histogram N_datapoints = sum(tab_blk(:)>0); % non blinking steps only hist(tab_alpha(tab_blk>0),2*sqrt(N_datapoints)) % using 2sqrt(N) bins xlabel('intensity (a.u.)'), ylabel('occurrence') title('histogram of particles fluorescence intensity')