<tfoot id='gj7zK'></tfoot>
      <bdo id='gj7zK'></bdo><ul id='gj7zK'></ul>
      <i id='gj7zK'><tr id='gj7zK'><dt id='gj7zK'><q id='gj7zK'><span id='gj7zK'><b id='gj7zK'><form id='gj7zK'><ins id='gj7zK'></ins><ul id='gj7zK'></ul><sub id='gj7zK'></sub></form><legend id='gj7zK'></legend><bdo id='gj7zK'><pre id='gj7zK'><center id='gj7zK'></center></pre></bdo></b><th id='gj7zK'></th></span></q></dt></tr></i><div id='gj7zK'><tfoot id='gj7zK'></tfoot><dl id='gj7zK'><fieldset id='gj7zK'></fieldset></dl></div>

    1. <small id='gj7zK'></small><noframes id='gj7zK'>

        <legend id='gj7zK'><style id='gj7zK'><dir id='gj7zK'><q id='gj7zK'></q></dir></style></legend>

        在 numpy/scipy 中查找函数 matlab

        时间:2023-08-30

          <tbody id='7fs8s'></tbody>
        1. <tfoot id='7fs8s'></tfoot>

            • <bdo id='7fs8s'></bdo><ul id='7fs8s'></ul>

              <small id='7fs8s'></small><noframes id='7fs8s'>

              • <i id='7fs8s'><tr id='7fs8s'><dt id='7fs8s'><q id='7fs8s'><span id='7fs8s'><b id='7fs8s'><form id='7fs8s'><ins id='7fs8s'></ins><ul id='7fs8s'></ul><sub id='7fs8s'></sub></form><legend id='7fs8s'></legend><bdo id='7fs8s'><pre id='7fs8s'><center id='7fs8s'></center></pre></bdo></b><th id='7fs8s'></th></span></q></dt></tr></i><div id='7fs8s'><tfoot id='7fs8s'></tfoot><dl id='7fs8s'><fieldset id='7fs8s'></fieldset></dl></div>

              • <legend id='7fs8s'><style id='7fs8s'><dir id='7fs8s'><q id='7fs8s'></q></dir></style></legend>

                • 本文介绍了在 numpy/scipy 中查找函数 matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对于 numpy/scipy,matlab 中是否有 find(A>9,1) 的等效函数.我知道 numpy 中有 nonzero 函数,但我需要的是第一个索引,以便我可以在另一个提取的列中使用第一个索引.

                  Is there an equivalent function of find(A>9,1) from matlab for numpy/scipy. I know that there is the nonzero function in numpy but what I need is the first index so that I can use the first index in another extracted column.

                  例如:A = [ 1 2 3 9 6 4 3 10 ]find(A>9,1) 将在 matlab 中返回索引 4

                  Ex: A = [ 1 2 3 9 6 4 3 10 ] find(A>9,1) would return index 4 in matlab

                  推荐答案

                  numpy中find的等价物是nonzero,但是不支持第二个参数.但是你可以做这样的事情来获得你正在寻找的行为.

                  The equivalent of find in numpy is nonzero, but it does not support a second parameter. But you can do something like this to get the behavior you are looking for.

                  B = nonzero(A >= 9)[0] 
                  

                  但是,如果您正在寻找的只是找到满足条件的第一个元素,那么您最好使用 max.

                  But if all you are looking for is finding the first element that satisfies a condition, you are better off using max.

                  例如,在 matlab 中,find(A >= 9, 1) 将等同于 [~, idx] = max(A >= 9).numpy 中的等效函数如下.

                  For example, in matlab, find(A >= 9, 1) would be the same as [~, idx] = max(A >= 9). The equivalent function in numpy would be the following.

                  idx = (A >= 9).argmax()
                  

                  这篇关于在 numpy/scipy 中查找函数 matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    <bdo id='y9FTN'></bdo><ul id='y9FTN'></ul>

                        <tbody id='y9FTN'></tbody>
                        <legend id='y9FTN'><style id='y9FTN'><dir id='y9FTN'><q id='y9FTN'></q></dir></style></legend>
                        <tfoot id='y9FTN'></tfoot>

                        <small id='y9FTN'></small><noframes id='y9FTN'>

                      1. <i id='y9FTN'><tr id='y9FTN'><dt id='y9FTN'><q id='y9FTN'><span id='y9FTN'><b id='y9FTN'><form id='y9FTN'><ins id='y9FTN'></ins><ul id='y9FTN'></ul><sub id='y9FTN'></sub></form><legend id='y9FTN'></legend><bdo id='y9FTN'><pre id='y9FTN'><center id='y9FTN'></center></pre></bdo></b><th id='y9FTN'></th></span></q></dt></tr></i><div id='y9FTN'><tfoot id='y9FTN'></tfoot><dl id='y9FTN'><fieldset id='y9FTN'></fieldset></dl></div>