matlab循环,想得到每一个theta循环下的矩阵,请问应该怎么编程

我想得到每一个theta值下的h矩阵,并且把它存到不同的excel中,但是运行出来的结果只显示了180度对应的h矩阵

img


我自己编的程序如下:
close all;
clear;
clc;
inputImage = imread('D:\COLOR\pps\frame30.jpg');
subplot(2,2,1);imshow(inputImage);
title('Input RGB image');
f = im2double(inputImage);%转换为双浮点类型
R=f(:,:,1);
G=f(:,:,2);
B=f(:,:,3);
for i=1:1:1200
for j=1:1:1920
r(i,j)=log(R(i,j)/G(i,j));
b(i,j)=log(B(i,j)/G(i,j));
end
end
for theta=0:1:180%得各角度投影灰度图
for i=1:1:1200
for j=1:1:1920
t(i,j)=r(i,j).*cosd(theta)+ b(i,j).*sind(theta);
h(i,j)=exp(t(i,j)); %指数化,引21
% xlswrite('D:\COLOR\saxx.xlsx',h);
% if theta>180
% break
end

end

end
% title(['Inv. Image using ' num2str(theta) ]);
% imwrite(image,['D:\COLOR\sa',num2str(theta),'.jpg']);%储存在sa中
% drawnow;
subplot(2,2,2);imshow(r);
title('log R/G');
subplot(2,2,3);imshow(b);
title('log B/G');
subplot(2,2,4);
x=mat2gray(h);%转为灰度图,引用20-引18
imshow(x);
title('invariant image');