1

Matlab code:

eminc = 2.5; %the increment of the emission spectra you collected
exinc = 5; %the increment of the excitation spectra you collected
em = 250:eminc:560; %Emission scan
ex = 240:exinc:450; %Excitation scan
A = xlsread(char(Afile));  % Reads in raw EEM file in .xlsx format.
ExTop=[0,ex]; %Recreates the row of excitation wavelengths cut off 
A=[ExTop ; A]; %Adds the excitation wavelengths back into the EEM file
Asize = size(A);

emfind = A(:,1);
emstart = find(emfind == findem(1));
emend = Asize(1);

exfind = A(emstart-1,:);
exstart = find(exfind == findex(1));
exend = Asize(2);

A = A(emstart:emend,exstart:exend);

for A=A(1:125,1:43)
   if emstart<=(ex+10)
       A=0;
        if emstart>=(ex*2+20)
         A=0;
        end
   end
end

Data is intensity of fluorescence from an excitation-emission matrix (size 125x43 matrix), and the Excitation wavelengths and Emission Wavelengths are also attached to the data (size 126x44 matrix)

I want to assign a value of 0 to the data matrix when the emission wavelengths are <= (excitation wavelengths+10) and when the excitation wavelengths are >= (excitation wavelengths*2+20)

I know the for loop and if statements are not right, mostly because I can not figure out how to even call up that area of data within my matrix.

The code is a little bit "verbose" so that if the scan parameters (excitation and emission wavelengths) are changed, they can be assigned and the rest of the code will work regardless.

Any help would be appreciated. Thanks

4

1 回答 1

2

另一种方法是我们只是将相关值选择到一个新数组中,例如:

[val ind]=find(A > (excitation wavelengths+10) & A< (excitation wavelengths*2+20) );
于 2012-12-03T21:26:16.323 回答