{"id":303655,"date":"2024-05-20T19:04:35","date_gmt":"2024-05-20T11:04:35","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/303655.html"},"modified":"2024-05-20T19:04:48","modified_gmt":"2024-05-20T11:04:48","slug":"%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8-matlab%e5%ae%9e%e7%8e%b0%e7%9f%a9%e9%98%b5%e7%9b%b8%e5%90%8c%e5%85%83%e7%b4%a0%e7%9a%84%e6%9f%a5%e6%89%be","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/303655.html","title":{"rendered":"\u5982\u4f55\u5229\u7528 Matlab\u5b9e\u73b0\u77e9\u9635\u76f8\u540c\u5143\u7d20\u7684\u67e5\u627e"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26215910\/4d266915-d980-4747-95b0-3e4301a91434.webp\" alt=\"\u5982\u4f55\u5229\u7528 Matlab\u5b9e\u73b0\u77e9\u9635\u76f8\u540c\u5143\u7d20\u7684\u67e5\u627e\" \/><\/p>\n<p><p>\u5229\u7528Matlab\u5b9e\u73b0\u77e9\u9635\u76f8\u540c\u5143\u7d20\u7684\u67e5\u627e\u4f5c\u4e3a\u4e00\u79cd\u5728\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u4e2d\u5e38\u7528\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u901a\u8fc7\u51e0\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002<strong>\u8fd9\u4e9b\u65b9\u6cd5\u5305\u62ec\uff1a\u904d\u5386\u67e5\u627e\u6cd5\u3001\u903b\u8f91\u7d22\u5f15\u6cd5\u548c\u5185\u7f6e\u51fd\u6570\u6cd5<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u903b\u8f91\u7d22\u5f15\u6cd5<\/strong>\u4ee5\u5176\u9ad8\u6548\u548c\u7b80\u6d01\u8457\u79f0\uff0c\u5728\u89e3\u51b3\u6b64\u7c7b\u95ee\u9898\u65f6\u8868\u73b0\u51fa\u8272\u3002<\/p>\n<\/p>\n<p><p>\u903b\u8f91\u7d22\u5f15\u6cd5\u5229\u7528Matlab\u4e2d\u7684\u903b\u8f91\u64cd\u4f5c\u6765\u7b80\u5316\u67e5\u627e\u8fc7\u7a0b\u3002\u901a\u8fc7\u6784\u9020\u4e00\u4e2a\u4e0e\u539f\u77e9\u9635\u540c\u5f62\u7684\u903b\u8f91\u77e9\u9635\uff0c\u8be5\u903b\u8f91\u77e9\u9635\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u4ee3\u8868\u539f\u77e9\u9635\u76f8\u5e94\u4f4d\u7f6e\u5143\u7d20\u662f\u5426\u6ee1\u8db3\u67d0\u4e00\u6761\u4ef6\uff08\u4f8b\u5982\u7b49\u4e8e\u67d0\u4e2a\u503c\uff09\u3002\u57fa\u4e8e\u8fd9\u4e2a\u903b\u8f91\u77e9\u9635\uff0c\u53ef\u4ee5\u5feb\u901f\u7d22\u5f15\u6216\u63d0\u53d6\u51fa\u6ee1\u8db3\u6761\u4ef6\u7684\u5143\u7d20\uff0c\u8fd9\u79cd\u65b9\u6cd5\u65e2\u9ad8\u6548\u53c8\u76f4\u89c2\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u51e0\u79cd\u5b9e\u7528\u7684\u65b9\u6cd5\u6765\u5b8c\u6210\u8fd9\u4e00\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u904d\u5386\u67e5\u627e\u6cd5<\/h3>\n<\/p>\n<p><p>\u8be5\u65b9\u6cd5\u901a\u8fc7\u53cc\u91cd\u5faa\u73af\u904d\u5386\u77e9\u9635\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u5e76\u4e0e\u76ee\u6807\u503c\u8fdb\u884c\u6bd4\u8f83\uff0c\u82e5\u76f8\u540c\uff0c\u5219\u8bb0\u5f55\u8be5\u5143\u7d20\u7684\u4f4d\u7f6e\u3002\u8fd9\u79cd\u65b9\u6cd5\u867d\u7136\u7b80\u5355\u76f4\u89c2\uff0c\u4f46\u5728\u5904\u7406\u5927\u578b\u77e9\u9635\u65f6\u6548\u7387\u4e0d\u9ad8\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u521d\u59cb\u5316\u4e00\u4e2a\u7a7a\u6570\u7ec4\u4ee5\u5b58\u50a8\u6ee1\u8db3\u6761\u4ef6\u7684\u5143\u7d20\u4f4d\u7f6e\u3002\u63a5\u7740\uff0c\u4f7f\u7528\u53cc\u91cd\u5faa\u73af\u5206\u522b\u904d\u5386\u77e9\u9635\u7684\u884c\u548c\u5217\uff0c\u6bd4\u8f83\u6bcf\u4e2a\u5143\u7d20\u662f\u5426\u4e0e\u76ee\u6807\u503c\u76f8\u540c\u3002\u82e5\u76f8\u540c\uff0c\u5219\u5c06\u5176\u4f4d\u7f6e\u4fe1\u606f\uff08\u5982\u884c\u5217\u5750\u6807\uff09\u4fdd\u5b58\u5230\u4e4b\u524d\u521d\u59cb\u5316\u7684\u6570\u7ec4\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u903b\u8f91\u7d22\u5f15\u6cd5<\/h3>\n<\/p>\n<p><p>\u903b\u8f91\u7d22\u5f15\u6cd5\u662f\u4e00\u79cd\u9ad8\u6548\u67e5\u627e\u77e9\u9635\u4e2d\u76f8\u540c\u5143\u7d20\u7684\u65b9\u6cd5\u3002\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u903b\u8f91\u77e9\u9635\uff0c\u8be5\u77e9\u9635\u4e0e\u539f\u77e9\u9635\u5927\u5c0f\u76f8\u540c\uff0c\u5176\u4e2d\u5143\u7d20\u503c\u4e3a<code>true<\/code>\u6216<code>false<\/code>\uff0c\u8868\u793a\u539f\u77e9\u9635\u5bf9\u5e94\u4f4d\u7f6e\u7684\u5143\u7d20\u662f\u5426\u6ee1\u8db3\u67d0\u4e00\u6761\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u5177\u4f53\u64cd\u4f5c\u5982\u4e0b\uff1a\u4f7f\u7528Matlab\u7684\u5173\u7cfb\u64cd\u4f5c\u7b26\uff08\u5982<code>==<\/code>\uff09\u6bd4\u8f83\u539f\u77e9\u9635\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u4e0e\u76ee\u6807\u503c\uff0c\u751f\u6210\u903b\u8f91\u77e9\u9635\u3002\u7136\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e2a\u903b\u8f91\u77e9\u9635\u4f5c\u4e3a\u7d22\u5f15\uff0c\u63d0\u53d6\u51fa\u539f\u77e9\u9635\u4e2d\u6ee1\u8db3\u6761\u4ef6\u7684\u5143\u7d20\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u4ee3\u7801\u7b80\u6d01\uff0c\u800c\u4e14\u6267\u884c\u6548\u7387\u9ad8\uff0c\u7279\u522b\u9002\u5408\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5185\u7f6e\u51fd\u6570\u6cd5<\/h3>\n<\/p>\n<p><p>Matlab\u63d0\u4f9b\u4e86\u591a\u79cd\u5185\u7f6e\u51fd\u6570\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b9e\u73b0\u77e9\u9635\u4e2d\u76f8\u540c\u5143\u7d20\u7684\u67e5\u627e\u3002\u4f8b\u5982\uff0c<code>find<\/code>\u51fd\u6570\u53ef\u4ee5\u627e\u51fa\u975e\u96f6\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u5f53\u4e0e\u903b\u8f91\u7d22\u5f15\u76f8\u7ed3\u5408\u65f6\uff0c\u53ef\u4ee5\u6709\u6548\u67e5\u627e\u77e9\u9635\u4e2d\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f7f\u7528\u903b\u8f91\u64cd\u4f5c\u751f\u6210\u4e00\u4e2a\u903b\u8f91\u77e9\u9635\uff0c\u7136\u540e\u5c06\u8fd9\u4e2a\u903b\u8f91\u77e9\u9635\u4f5c\u4e3a<code>find<\/code>\u51fd\u6570\u7684\u8f93\u5165\u3002<code>find<\/code>\u51fd\u6570\u5c06\u8fd4\u56de\u6ee1\u8db3\u6761\u4ef6\uff08\u5373\u903b\u8f91\u77e9\u9635\u4e2d\u503c\u4e3a<code>true<\/code>\u7684\u4f4d\u7f6e\uff09\u7684\u7ebf\u6027\u7d22\u5f15\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u4e9b\u7d22\u5f15\u662f\u9488\u5bf9\u77e9\u9635\u5c55\u5e73\uff08\u5217\u4f18\u5148\uff09\u540e\u7684\u7ed3\u679c\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u8fdb\u4e00\u6b65\u8f6c\u6362\u8fd9\u4e9b\u7ebf\u6027\u7d22\u5f15\u4e3a\u884c\u5217\u5750\u6807\u5f62\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u6bd4\u8f83\u4e0e\u9009\u62e9<\/h3>\n<\/p>\n<p><p><strong>\u904d\u5386\u67e5\u627e\u6cd5<\/strong>\u867d\u7b80\u5355\uff0c\u4f46\u5728\u5904\u7406\u5927\u578b\u77e9\u9635\u65f6\u6548\u7387\u4f4e\u4e0b\u3002<strong>\u903b\u8f91\u7d22\u5f15\u6cd5<\/strong>\u4ee5\u5176\u9ad8\u6548\u7b80\u6d01\u8d62\u5f97\u4e86\u5e7f\u6cdb\u7684\u5e94\u7528\uff0c\u7279\u522b\u662f\u5728\u9700\u8981\u5bf9\u77e9\u9635\u8fdb\u884c\u590d\u6742\u64cd\u4f5c\u65f6\u3002<strong>\u5185\u7f6e\u51fd\u6570\u6cd5<\/strong>\u63d0\u4f9b\u4e86\u5feb\u901f\u5b9e\u73b0\u7684\u9014\u5f84\uff0c\u4f46\u53ef\u80fd\u9700\u8981\u4e00\u5b9a\u7684\u8f6c\u6362\u6216\u989d\u5916\u64cd\u4f5c\u4ee5\u9002\u5e94\u7279\u5b9a\u7684\u5e94\u7528\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u9700\u6c42\u548c\u77e9\u9635\u7684\u89c4\u6a21\u3002\u5728\u9762\u5bf9\u5927\u89c4\u6a21\u77e9\u9635\u548c\u590d\u6742\u6570\u636e\u7ed3\u6784\u65f6\uff0c\u63a8\u8350\u4f7f\u7528\u903b\u8f91\u7d22\u5f15\u6cd5\u6216\u5185\u7f6e\u51fd\u6570\u6cd5\u4ee5\u63d0\u9ad8\u6548\u7387\u548c\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5229\u7528 Matlab\u67e5\u627e\u77e9\u9635\u4e2d\u91cd\u590d\u7684\u5143\u7d20\uff1f<\/strong><br \/>\n\u5728 Matlab \u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 unique() \u51fd\u6570\u6765\u67e5\u627e\u77e9\u9635\u4e2d\u7684\u91cd\u590d\u5143\u7d20\u3002\u5c06\u77e9\u9635\u4f5c\u4e3a\u8f93\u5165\u53c2\u6570\u4f20\u9012\u7ed9 unique() \u51fd\u6570\uff0c\u5b83\u5c06\u8fd4\u56de\u7531\u65e0\u91cd\u590d\u5143\u7d20\u7ec4\u6210\u7684\u77e9\u9635\u3002\u901a\u8fc7\u6bd4\u8f83\u8f93\u5165\u77e9\u9635\u548c unique() \u51fd\u6570\u7684\u8f93\u51fa\u77e9\u9635\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u77e9\u9635\u4e2d\u91cd\u590d\u7684\u5143\u7d20\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u5229\u7528 Matlab\u67e5\u627e\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u7d22\u5f15\uff1f<\/strong><br \/>\n\u8981\u67e5\u627e\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u7d22\u5f15\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 unique() \u51fd\u6570\u7684\u7b2c\u4e8c\u4e2a\u8f93\u51fa\u53c2\u6570\u3002\u5c06\u77e9\u9635\u4f5c\u4e3a\u8f93\u5165\u53c2\u6570\u4f20\u9012\u7ed9 unique() \u51fd\u6570\uff0c\u7136\u540e\u5c06\u5176\u8f93\u51fa\u8d4b\u503c\u7ed9\u4e24\u4e2a\u53d8\u91cf\uff0c\u4f8b\u5982 [C, ia, ic] = unique(A)\uff0c\u5176\u4e2d A \u662f\u8f93\u5165\u77e9\u9635\uff0cia \u662f\u65e0\u91cd\u590d\u5143\u7d20\u7684\u7d22\u5f15\u5411\u91cf\uff0cic \u662f\u8f93\u5165\u77e9\u9635\u5143\u7d20\u5728\u65e0\u91cd\u590d\u5143\u7d20\u5411\u91cf\u4e2d\u7684\u7d22\u5f15\u3002\u901a\u8fc7\u67e5\u770b ic \u5411\u91cf\u7684\u91cd\u590d\u5143\u7d20\uff0c\u60a8\u53ef\u4ee5\u627e\u5230\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u7d22\u5f15\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u5229\u7528 Matlab\u67e5\u627e\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u6570\u91cf\uff1f<\/strong><br \/>\n\u8981\u67e5\u627e\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u6570\u91cf\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 histcounts() \u51fd\u6570\u3002\u5c06\u77e9\u9635\u4f5c\u4e3a\u8f93\u5165\u53c2\u6570\u4f20\u9012\u7ed9 histcounts() \u51fd\u6570\uff0c\u5b83\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6bcf\u4e2a\u5143\u7d20\u5728\u8f93\u5165\u77e9\u9635\u4e2d\u51fa\u73b0\u6b21\u6570\u7684\u76f4\u65b9\u56fe\u7edf\u8ba1\u5411\u91cf\u3002\u901a\u8fc7\u5bf9\u76f4\u65b9\u56fe\u7edf\u8ba1\u5411\u91cf\u4e2d\u5927\u4e8e 1 \u7684\u5143\u7d20\u6c42\u548c\uff0c\u60a8\u53ef\u4ee5\u5f97\u5230\u77e9\u9635\u4e2d\u91cd\u590d\u5143\u7d20\u7684\u6570\u91cf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5229\u7528Matlab\u5b9e\u73b0\u77e9\u9635\u76f8\u540c\u5143\u7d20\u7684\u67e5\u627e\u4f5c\u4e3a\u4e00\u79cd\u5728\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u4e2d\u5e38\u7528\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u901a\u8fc7\u51e0\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002\u8fd9\u4e9b\u65b9 [&hellip;]","protected":false},"author":3,"featured_media":303667,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/303655"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=303655"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/303655\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/303667"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=303655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=303655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=303655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}