【发布时间】:2012-12-03 21:04:40
【问题描述】:
Matlab 代码:
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
数据是来自激发-发射矩阵(尺寸 125x43 矩阵)的荧光强度,激发波长和发射波长也附在数据上(尺寸 126x44 矩阵)
当发射波长=(激发波长*2+20)时,我想为数据矩阵分配0值
我知道 for 循环和 if 语句不正确,主要是因为我不知道如何调用矩阵中的数据区域。
代码有点“冗长”,因此如果扫描参数(激发和发射波长)发生变化,可以分配它们,并且代码的其余部分无论如何都可以工作。
任何帮助将不胜感激。 谢谢
【问题讨论】:
标签: matlab if-statement for-loop