Matlab,分配一个;“如果声明”;在「;“循环”;

Matlab,分配一个;“如果声明”;在「;“循环”;,matlab,if-statement,for-loop,Matlab,If Statement,For Loop,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 i

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
eminc=2.5;%收集的发射光谱的增量
exinc=5;%收集的激发光谱的增量
em=250:eminc:560;%发射扫描
ex=240:exinc:450;%激发扫描
A=xlsread(char(Afile));%以.xlsx格式读取原始EEM文件。
ExTop=[0,ex];%重新创建被切断的激发波长行
A=[ExTop;A];%将激发波长添加回EEM文件
Asize=尺寸(A);
emfind=A(:,1);
emstart=find(emfind==findem(1));
校正=Asize(1);
exfind=A(emstart-1,:);
exstart=find(exfind==findex(1));
exend=Asize(2);
A=A(emstart:emed,exstart:exend);
对于A=A(1:125,1:43)
如果emstart=(例如*2+20)
A=0;
结束
结束
结束
数据是来自激发-发射矩阵(尺寸125x43矩阵)的荧光强度,激发波长和发射波长也附加到数据(尺寸126x44矩阵)

当发射波长为=(激发波长*2+20)时,我想给数据矩阵赋值0

我知道for循环和if语句不正确,主要是因为我不知道如何调用矩阵中的数据区域

该代码有点“冗长”,因此,如果扫描参数(激发和发射波长)发生变化,则可以对其进行分配,而代码的其余部分将不受影响地工作

任何帮助都将不胜感激。
谢谢

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

[val ind]=find(A > (excitation wavelengths+10) & A< (excitation wavelengths*2+20) );
[val ind]=find(A>(激发波长+10)和A<(激发波长*2+20));