我试图得到一个空的10*10网格单元,以填补它与一些输出之后。我写的代码是:
patch(1:100)=1:100;
mapmatrix= zeros(100,100);
for patchi=1:100,
for cellxi=1:10,
for cellyi=1:10,
mapmatrix(mod(patchi-1,10)*10+cellxi,ceil(patchi/10)*10+cellyi)=patch(patchi);
,end,end,end;
imagesc(mapmatrix)有人知道为什么我要得到一个10*11网格单元而不是10*10吗?
THX
发布于 2014-04-08 12:55:38
很明显,这是因为对于牛索引和列索引使用不同的索引计算方法。
mod(patchi-1,10)*10+cellxivs
ceil(patchi/10)*10+cellyihttps://stackoverflow.com/questions/22937587
复制相似问题