This script is being used for image processing by multiplying a set of 2000 images with a mask and then summing the values in each frame. These values are entered into a row vector called Intensity.
该脚本被用于图像处理,通过将一组2000个图像与一个掩码相乘,然后将每个帧中的值相加。这些值被输入到一个称为强度的行向量中。
I am trying to end up with 20 row vectors called intensity1, intesity2...intensity20, is there a straight forward way to change the name of the Intensity row vector upon every loop iteration?
我尝试用20个行向量,称为强度1,intesity2…强度,在每个循环迭代中是否有一个直接的方法来改变强度行向量的名称?
for m=1:20
mask=bigrating(m,m,0);
for n=1:2000
I=sum(sum(imread((sprintf('image%05d.tif',n))).*(mask)));
Intensity(n)=I;
end
save('filepath','Intensity')
end
1 个解决方案
#1
0
Because you wanted dynamically named intensity1, intensity2,....intensity20 etc, the following should work for you:
因为你想要动态命名的强度1,强度2,强度20等,下面应该为你工作:
for m = 1:20
mask = bigrating(m,m,0)
for n = 1:2000
I=sum(sum(imread((sprintf('image%05d.tif',n))).*(mask)));
eval(['intensity' num2str(m) ' = I'])
end
save('filepath', ['intensity' num2str(m)])
end
#1
0
Because you wanted dynamically named intensity1, intensity2,....intensity20 etc, the following should work for you:
因为你想要动态命名的强度1,强度2,强度20等,下面应该为你工作:
for m = 1:20
mask = bigrating(m,m,0)
for n = 1:2000
I=sum(sum(imread((sprintf('image%05d.tif',n))).*(mask)));
eval(['intensity' num2str(m) ' = I'])
end
save('filepath', ['intensity' num2str(m)])
end