numpy.ravel_multi_index错误 - 试图获取索引

时间:2016-04-23 09:03:02

标签: python numpy multidimensional-array

我正在使用([13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], [21, 22, 23, 24, 25, 26]) 将一组nd-index转换为线性/平面索引列表。

提供我的nd元组数组,看起来像这样(x,y,z):

(42, 36, 50)

应该投射“平面指数”的原始矩阵的尺寸:

ValueError: operands could not be broadcast together with shapes (14,) (22,) (6,) 

这是一个错误说:

function IB = ibtest(VCC)
    RL = [1000, 10000, 200000, 400000, 600000, 800000, 1000000];
    RB = 22000;
    RP = 50;
    R = 470;
    B = 300;
    i = 0;
    for t = 1:length(RL)
        i = i+1;
        IB(i) = ((VCC - 2.1)*(RL(i) + RP)) / ( (RL(i) * RP) + (RB*(RL(i) + RP)) + (301 * 470 * (RL(i) + RP)) );
    end
    IB
end

但是我不确定为什么会这样?这些指数来自具有暗淡(42,36,50)的矩阵,那么为什么这是一个问题呢?

0 个答案:

没有答案