将代码从Matlab转换为python

时间:2019-05-29 02:35:30

标签: python matlab syntax-error

嗨,我在matlab中有一段代码将其转换为Python。 for循环中似乎存在语法错误。您能告诉我这里有什么错误吗?

对于范围(1,len(Partition))中的i:

        YY = YY + np.int8(Codebook[i] * (B_forward > Partition[i] and B_forward <= Partition[i])

        B_forward = YY + np.int8(Codebook[-1] * (B_forward > Partition[-1]))

Matlab代码:

for i = 2:length(Partition)
                    YY= YY + int8(Codebook(i)*(B_forward>Partition(i-1) & B_forward<= Partition(i)));
                end
                B_forward = YY + int8( Codebook(end)*(B_forward>Partition(end)));

对于循环错误

0 个答案:

没有答案