【问题标题】:Working with Matlab functions in C++ (for matrix searching)在 C++ 中使用 Matlab 函数(用于矩阵搜索)
【发布时间】:2012-04-13 10:47:40
【问题描述】:

我想要做的是在一个更大的二维矩阵中搜索一个二维矩阵。为此,我找到了 Boyer-Moore 算法的 2d 版本。 但是在 matlab 中处理矩阵总是更容易,所以我想知道是否可以在 C++ 编译器中调用 matlab 函数。

我认为这里的人知道如何在 matlab 中做到这一点。
http://www.mathworks.com/matlabcentral/newsreader/view_thread/247971

有没有为此目的而存在的图书馆或其他东西?它至少包含上面链接中给出的程序使用的功能。

PS:如果有人能提供这个搜索问题的解决方案,请做。

【问题讨论】:

    标签: c++ matlab matrix


    【解决方案1】:

    这是您在Matlab documentation 中寻找的内容

    【讨论】:

      【解决方案2】:

      我不知道这方面的任何库,您可能会更幸运地查看 matlab 网站,看看他们是否出售开发库。

      至于解决方案,这个问题在概念上似乎与在字符串中查找子字符串的问题非常相似。我在简单搜索时找到了this,我相信它会有所帮助。

      至于基本解决方案,可以这样:

      您想在n x m 矩阵中找到p x q 子矩阵。

          for each row (up to row n - p):
            search each column (up to column m - q)
              if value in matrix equals first value check the rest of the submatrix
                if submatrix found, exit or store solution and keep looking for more
      

      【讨论】:

        猜你喜欢
        • 2015-07-10
        • 1970-01-01
        • 2013-01-20
        • 1970-01-01
        • 2018-05-17
        • 2011-12-24
        • 2015-03-06
        • 2022-09-26
        • 2015-06-10
        相关资源
        最近更新 更多