[問題] 請問如何改善MATLAB的這一個警告已回收
以下是我的程式擷取
-----------------------------------------------------------------------
for x = 1:subsize
for y = 1:subsize
if(x==1||x==subsize||y==1||y==subsize)
if(x==1&&y==1)
temp1指定某一個數字給他
elseif(x==1&&y==subsize)
temp1指定某一個數字給他
elseif(x==subsize&&y==1)
temp1指定某一個數字給他
elseif(x==subsize&&y==subsize)
temp1指定某一個數字給他
elseif(x==1&&y~=1&&y~=subsize)
temp1指定某一個數字給他
elseif(x==subsize&&y~=1&&y~=subsize)
temp1指定某一個數字給他
elseif(x~=1&&x~=subsize&&y==1)
temp1指定某一個數字給他
elseif(x~=1&&x~=subsize&&y==subsize)
end
else
temp1指定某一個數字給他
end
end
--------------------
整段程式就是說在判斷一個矩陣如果是四個頂點(就分別給不同的4個數字)
是四周邊邊可是不是頂點就給他其他4個數字
如果不是頂點也不是邊邊就給他另一個數字
跑是可以跑 不過MATLAB成是旁邊有黃色警告
他寫說
"temp1" might be growing inside a loop ,consider preallocating for speed
請問我該如何改善這個問題 有別的寫法嗎??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.71.11.199
推
06/19 03:59, , 1F
06/19 03:59, 1F
→
06/19 04:00, , 2F
06/19 04:00, 2F
→
06/19 13:43, , 3F
06/19 13:43, 3F
→
06/20 00:32, , 4F
06/20 00:32, 4F