2011-09-20 53 views
0

我正試圖在matlab中使用模式函數來處理數組數組(在此數組中有一些負的負數)。 但是當我做Matlab中的模式函數

模式(this_array)

我得到「試圖訪問模式(-1);指數必須是正整數或邏輯」。

以下是我的一段代碼:

for row=1:K, 
    ind = index(row); 
    label = trY(ind); 
    i = i + 1; 
end % for 

y = mode(label); // gives error esp. when the array contains only one negative value 

感謝。

回答

3

您的程序中很可能有一個名爲mode的變量。哈哈!

+0

哈! :)是的!非常感謝:)上帝保佑。 ! – svk