Equivalent python for a matlab line?
2 次查看(过去 30 天)
显示 更早的评论
Hi all,
May I know how could I represent the following line to python:
X = y(z(i,1:12),1);
回答(1 个)
Walter Roberson
2021-10-15
X = Y[z[i, 0:11],0]
would be my guess.
However, this relies upon the values in z having been changed to index 0 based instead of index 1 based. If the computation of z values was left the same between the two language, with the result that the minimum possible z value was 1 and you want that to indicate the first element in Y, then you would have to subtract 1:
X = Y[z[i, 0:11]-1,0]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!