{"id":7316,"date":"2022-09-12T18:11:28","date_gmt":"2022-09-12T09:11:28","guid":{"rendered":"https:\/\/blogs.mathworks.com\/japan-community\/?p=7316"},"modified":"2022-09-12T18:11:28","modified_gmt":"2022-09-12T09:11:28","slug":"model_callback","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/japan-community\/2022\/09\/12\/model_callback\/","title":{"rendered":"MATLAB\/Simulink \u306e\u753b\u9762\u5207\u308a\u66ff\u3048\u3068\u306f\u304a\u3055\u3089\u3070\uff01\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u30b9\u30b9\u30e1"},"content":{"rendered":"<p>\u7686\u3055\u3093\u3053\u3093\u306b\u3061\u306f\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c1\u30fc\u30e0\u306e\u9060\u85e4\u3067\u3059\u3002\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001\u300cMATLAB \u3068 Simulink \u3092\u7e4b\u3050\u300d\u3092\u30c6\u30fc\u30de\u306b\u3001\u4e3b\u306b\u6280\u8853\u7684\u306a\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u524d\u56de\u306e\u6295\u7a3f\u306f MATLAB Expo \u5f8c\u306a\u306e\u3067\u3001\u7d04\uff13\u304b\u6708\u3076\u308a\u306e\u6295\u7a3f\u306b\u306a\u308a\u307e\u3059\u306d\u3002\u524d\u56de\u306e\u5185\u5bb9\u306f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b3\u30f3\u30c6\u30b9\u30c8\u306e\u7d39\u4ecb\u3067\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u901a\u5e38\u901a\u308a\u6280\u8853\u7684\u306a\u5185\u5bb9\u3068\u306a\u308a\u307e\u3059\u3002MATLAB \u3068 Simulink \u3092\u3046\u307e\u304f\u7d44\u307f\u5408\u308f\u305b\u3066\u4f5c\u696d\u306e\u52b9\u7387\u5316\u3092\u884c\u3046\u6a5f\u80fd\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1><span style=\"color: #ff6600\">0. Simulink \u30e2\u30c7\u30ea\u30f3\u30b0\u30fb\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u81ea\u52d5\u5316\u3084\u52b9\u7387\u5316\u306e\u60a9\u307f<\/span><\/h1>\n<p>Simulink \u3067\u306e\u30e2\u30c7\u30ea\u30f3\u30b0\u3084\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u696d\u306e\u81ea\u52d5\u5316\u30fb\u52b9\u7387\u5316\u306b\u5f79\u7acb\u3064\u6a5f\u80fd\u3068\u3057\u3066\u3001\u4eca\u307e\u3067 <a href=\"https:\/\/blogs.mathworks.com\/japan-community\/2020\/02\/19\/control-simulink-from-matlab-with-simulink-api\/?from=jp\">Simulink API<\/a> \u3084 <a href=\"https:\/\/blogs.mathworks.com\/japan-community\/2020\/05\/14\/create-simulink-model-simulation-app-in-app-designer\/?from=jp\">App Designer \u3067\u306e\u30a2\u30d7\u30ea\u958b\u767a<\/a>\u3001\u3068\u3044\u3063\u305f\u6a5f\u80fd\u3092\u7d39\u4ecb\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u3053\u308c\u3089\u306e\u6a5f\u80fd\u306f\u57fa\u672c\u7684\u306b\u306f MATLAB \u5074\u3067\u4f7f\u3046\u3082\u306e\u3067\u3059\u3002Simulink \u3092\u30e1\u30a4\u30f3\u3067\u4f7f\u3063\u3066\u3044\u308b\u4eba\u306b\u3068\u3063\u3066\u306f\u300c\u3044\u3061\u3044\u3061 MATLAB \u306b\u753b\u9762\u3092\u79fb\u3059\u306e\u306f\u9762\u5012\uff01\u300d\u3068\u3044\u3046\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"528\" class=\"aligncenter size-large wp-image-7394\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/\u884c\u3063\u305f\u308a\u6765\u305f\u308a-1024x528.png\" alt=\"\" \/><\/p>\n<p>\u305d\u3053\u3067\u3001\u305d\u3046\u3044\u3063\u305f\u65b9\u5411\u3051\u306b\u3001\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f Simulink \u5074\u3067\u4f5c\u696d\u306e\u81ea\u52d5\u5316\u30fb\u52b9\u7387\u5316\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u4fbf\u5229\u6a5f\u80fd\u306e\u4e00\u3064\u3001\u300c\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u300d\u306b\u3064\u3044\u3066\u3053\u306e\u8a18\u4e8b\u3067\u306f\u7d39\u4ecb\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">1.\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3068\u306f<\/span><\/h1>\n<p><span style=\"color: #000000\"><a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/ug\/model-callbacks.html\">\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af<\/a>\u3068\u306f\u3001\u30e2\u30c7\u30eb\u304c\u7279\u5b9a\u306e\u51e6\u7406\u3092\u884c\u3046\u969b\u306b\u81ea\u52d5\u3067\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406\u306e\u3053\u3068\u3067\u3059\u3002<\/span><\/p>\n<p><span style=\"color: #000000\">\u4f8b\u3048\u3070\u3001<\/span><span style=\"color: #000000\">\u4eba\u304b\u3089\u3082\u3089\u3063\u305f\u30e2\u30c7\u30eb\u3084 MathWorks \u306e\u30c7\u30e2\u30e2\u30c7\u30eb\u3092\u958b\u3044\u305f\u969b\u306b\u3001\u3044\u3064\u306e\u9593\u306b\u304b\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306b\u5909\u6570\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u305f\u3001\u3068\u3044\u3046\u7d4c\u9a13\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f\u7279\u306b\u4f55\u304b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u305f\u308f\u3051\u3067\u3082\u306a\u304f\u5358\u306b\u30e2\u30c7\u30eb\u3092\u958b\u3044\u305f\u3060\u3051\u306a\u306e\u306b\u5909\u6570\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u56f0\u60d1\u3057\u305f\u3001\u3068\u3044\u3046\u65b9\u3082\u3044\u3089\u3063\u3057\u3083\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u5b9f\u306f\u3001\u3053\u308c\u3089\u306e\u30e2\u30c7\u30eb\u3067\u306f\u3001\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306b\u3088\u3063\u3066\u300c\u30e2\u30c7\u30eb\u3092\u958b\u304f\u300d\u76f4\u524d\u306b\u300c\u5909\u6570\u306e\u8aad\u307f\u8fbc\u307f\u300d\u304c\u81ea\u52d5\u3067\u884c\u308f\u308c\u3066\u3044\u308b\u3093\u3067\u3059\u3002<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"544\" class=\"aligncenter size-large wp-image-7400\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/\u3044\u3064\u306e\u9593\u306b-1024x544.png\" alt=\"\" \/><\/p>\n<p style=\"text-align: center\">\u4f8b\uff1af14 \u3068\u3044\u3046\u30c7\u30e2\u30e2\u30c7\u30eb\u3092\u958b\u304f\u3068\u3001\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u81ea\u52d5\u7684\u306b\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306b\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u30e2\u30c7\u30eb\u3092\u5b9f\u884c\u3059\u308b\u969b\u306b\u5fc5\u8981\u306a\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3067\u304d\u308b\u305f\u3081\u3001Simulink \u306e\u30e2\u30c7\u30eb\u306b\u610f\u8b58\u3092\u96c6\u4e2d\u3067\u304d\u308b\u306e\u304c\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u5927\u304d\u306a\u30e1\u30ea\u30c3\u30c8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">2. \u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u8a2d\u5b9a\u65b9\u6cd5<\/span><\/h1>\n<p>\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u8a2d\u5b9a\u65b9\u6cd5\u306f\u3068\u3066\u3082\u7c21\u5358\u3067\u3059\u3002Simulink \u306e\u300c\u30e2\u30c7\u30eb\u5316\u300d\u30bf\u30d6\u306e\u300c\u30e2\u30c7\u30eb\u8a2d\u5b9a\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3001\u300c\u30e2\u30c7\u30eb \u30d7\u30ed\u30d1\u30c6\u30a3\u300d\u3092\u9078\u3073\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"544\" class=\"aligncenter size-large wp-image-7328\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/08\/\u30e2\u30c7\u30eb\u30d7\u30ed\u30d1\u30c6\u30a3-1024x544.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u3059\u308b\u3068\u3001\u300c\u30e2\u30c7\u30eb \u30d7\u30ed\u30d1\u30c6\u30a3\u300d\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u958b\u304d\u307e\u3059\u306e\u3067\u3001\u300c\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u300d\u30bf\u30d6\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"777\" height=\"661\" class=\"aligncenter size-full wp-image-7334\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/08\/\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u753b\u9762.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&#8220;PreLoadFcn&#8221;, &#8220;PostLoadFcn&#8221; \u306a\u3069\u3001\u3055\u307e\u3056\u307e\u306a\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u540d\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u5b9f\u884c\u30bf\u30a4\u30df\u30f3\u30b0\u304c\u305d\u308c\u305e\u308c\u7570\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u540d\u3068\u5b9f\u884c\u30bf\u30a4\u30df\u30f3\u30b0\u306e\u5bfe\u5fdc\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<table style=\"height: 334px\" border=\"1\" width=\"434\">\n<tbody>\n<tr align=\"left\">\n<th style=\"padding-left: 40px\">PreLoadFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u76f4\u524d<\/th>\n<\/tr>\n<tr align=\"left\">\n<th style=\"padding-left: 40px\">PostLoadFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3060\u76f4\u5f8c<\/th>\n<\/tr>\n<tr align=\"left\">\n<th style=\"padding-left: 40px\">InitFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u958b\u59cb\u6642<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">StartFcn<\/th>\n<th>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u958b\u59cb\u6642<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">PuaseFcn<\/th>\n<th>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u4e00\u6642\u505c\u6b62\u6642<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">ContinueFcn<\/th>\n<th>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u518d\u958b\u6642<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">ContinueFcn<\/th>\n<th>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u7d42\u4e86\u6642<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">PreSaveFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u76f4\u524d<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">PostSaveFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u3092\u4fdd\u5b58\u3057\u305f\u76f4\u5f8c<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">StopFcn<\/th>\n<th>\u30e2\u30c7\u30eb\u3092\u9589\u3058\u308b\u524d<\/th>\n<\/tr>\n<tr style=\"padding-left: 40px\" align=\"left\">\n<th style=\"padding-left: 40px\">StopFcn<\/th>\n<th>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u7d42\u4e86\u6642<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u307e\u305f\u3001\u5404\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u9078\u3076\u3068\u3001\u53f3\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u305f\u3081\u306e\u67a0\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u3053\u3053\u306b MATLAB \u8a00\u8a9e\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u3053\u3068\u3067\u3001\u305d\u306e\u51e6\u7406\u304c\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3068\u3057\u3066\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h1><span style=\"color: #ff6600\">3.\u4fbf\u5229\u306a\u4f7f\u3044\u65b9<\/span><\/h1>\n<h2><\/h2>\n<h2><span style=\"color: #ff6600\">\u2460\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u5fc5\u8981\u306a\u5909\u6570\u306e\u8aad\u307f\u8fbc\u307f\u306e\u81ea\u52d5\u5316\uff08PreLoadFcn\uff09<\/span><\/h2>\n<p>\u304a\u305d\u3089\u304f\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u7528\u9014\u3068\u3057\u3066\u6700\u3082\u591a\u3044\u306e\u304c\u3053\u308c\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u30e2\u30c7\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u969b\u306b\u5b9f\u884c\u3055\u308c\u308bPreLoadFcn\u306b\u5909\u6570\u3092\u8aad\u307f\u8fbc\u3080\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u3044\u3061\u3044\u3061MATLAB\u5074\u3067\u5909\u6570\u3092\u8aad\u307f\u8fbc\u3080\u5fc5\u8981\u306f\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30d0\u30cd\u30fb\u30de\u30b9\u30fb\u30c0\u30f3\u30d1\u30e2\u30c7\u30eb\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"544\" class=\"aligncenter size-large wp-image-7343\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/08\/\u30d0\u30cd\u30de\u30b9\u30c0\u30f3\u30d1-1024x544.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u306e\u30e2\u30c7\u30eb\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306f m, c, k \u3068\u3044\u3046\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6e96\u5099\u306b\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u5b9a\u7fa9\u3059\u308b\u3001m \u30d5\u30a1\u30a4\u30eb\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3001.mat \u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3057\u3066\u8aad\u307f\u8fbc\u3080\u3001\u306a\u3069\u306a\u3069\u3044\u308d\u3044\u308d\u306a\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u3069\u308c\u3082\u4e00\u5ea6 MATLAB \u5074\u306b\u623b\u3063\u3066\u64cd\u4f5c\u3092\u884c\u308f\u306a\u304f\u3066\u306f\u3044\u3051\u306a\u3044\u306e\u3067\u5c11\u3057\u9762\u5012\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5b9a\u7fa9\u3092\u884c\u3046\u51e6\u7406\u3092 PreLoadFcn \u306b\u8a18\u8ff0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"777\" height=\"661\" class=\"aligncenter size-full wp-image-7349\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/08\/\u30d7\u30ea\u30ed\u30fc\u30c9.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u306e\u72b6\u614b\u3067\u30e2\u30c7\u30eb\u3092\u958b\u3044\u3066\u307f\u308b\u3068\u2026\u2026<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"544\" class=\"aligncenter size-large wp-image-7355\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/08\/\u30d7\u30ea\u30ed\u30fc\u30c9\u5b9f\u884c\u5f8c-1024x544.png\" alt=\"\" \/><\/p>\n<p>\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306b\uff13\u3064\u306e\u5909\u6570\u304c\u81ea\u52d5\u3067\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\uff01\u3053\u306e\u3088\u3046\u306b\u3001PreLoadFcn \u306b\u5909\u6570\u306e\u5b9a\u7fa9\u3084\u8aad\u307f\u8fbc\u307f\u306e\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3068\u3001MATLAB \u5074\u3067\u308f\u3056\u308f\u3056\u30b3\u30de\u30f3\u30c9\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u306a\u304f\u3066\u3044\u3044\u306e\u3067\u3068\u3063\u3066\u3082\u697d\u3067\u3059\u306d\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #ff6600\">\u2461\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u306e\u53ef\u8996\u5316\u30fb\u89e3\u6790\u306e\u81ea\u52d5\u5316\uff08StopFcn\uff09<\/span><\/h2>\n<p>\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5f8c\u306e\u53ef\u8996\u5316\u3084\u89e3\u6790\u3082StopFcn\u3092\u4f7f\u3048\u3070\u81ea\u52d5\u5316\u3067\u304d\u307e\u3059\u3002\u8a66\u3057\u306b\u5148\u307b\u3069\u306e\u30e2\u30c7\u30eb\u306e\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u5f8c\u306b\u51fa\u529b\u4fe1\u53f7\u306e\u6700\u5927\u5024\u3092\u8a3a\u65ad\u30c0\u30a4\u30a2\u30ed\u30b0\u306b\u8868\u793a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u51fa\u529b\u4fe1\u53f7\u306b\u300c\u4fe1\u53f7\u306e\u30ed\u30b0\u300d\u3092\u8a2d\u5b9a\u3057\u3001StopFcn \u306b <a href=\"https:\/\/jp.mathworks.com\/help\/matlab\/ref\/disp.html\">disp<\/a> \u95a2\u6570\u3067\u305d\u306e\u6700\u5927\u5024\u3092\u8868\u793a\u3059\u308b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3068\u2026\u2026<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1022\" height=\"876\" class=\"aligncenter size-full wp-image-7370\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/StopFcn.png\" alt=\"\" \/><\/p>\n<p>\u8a3a\u65ad\u30d3\u30e5\u30fc\u30a2\u30fc\u306b\u6700\u5927\u5024\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\uff01\u3053\u306e\u3088\u3046\u306b\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u7d50\u679c\u306e\u7c21\u5358\u306a\u89e3\u6790\u51e6\u7406\u306f StopFcn \u3067\u8a3a\u65ad\u30d3\u30e5\u30fc\u30a2\u30fc\u306b\u8868\u793a\u3057\u3066\u3057\u307e\u3048\u3070\u3001\u3044\u3061\u3044\u3061 MATLAB \u5074\u3067\u7d50\u679c\u3092\u8868\u793a\u3057\u306a\u3044\u3067\u3044\u3044\u306e\u3067\u697d\u3067\u3059\u306d\u3002<\/p>\n<p>\u4ed6\u306b\u3082\u3001Scope \u30d6\u30ed\u30c3\u30af\u3084\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u30a4\u30f3\u30b9\u30da\u30af\u30bf\u30fc\u306a\u3069\u3067\u306f\u63cf\u753b\u3067\u304d\u306a\u3044\u3088\u3046\u306a\u9ad8\u5ea6\u306a\u30d7\u30ed\u30c3\u30c8\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u3001 StopFcn \u3067\u5b9f\u88c5\u3057\u3066\u3057\u307e\u3063\u3066\u3082\u3088\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #ff6600\">\u2462\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u6642\u306e\u30b9\u30b3\u30fc\u30d7\u8d77\u52d5\u306e\u81ea\u52d5\u5316\uff08StartFcn\uff09<\/span><\/h2>\n<p>StartFcn\u3092\u4f7f\u3048\u3070\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u6642\u306b\u7279\u5b9a\u306e\u64cd\u4f5c\u3092\u884c\u3046\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3057\u305f\u3044\u30e2\u30c7\u30eb\u306e\u8907\u6570\u500b\u6240\u306b\u30b9\u30b3\u30fc\u30d7\u30d6\u30ed\u30c3\u30af\u304c\u6563\u3089\u3070\u3063\u3066\u3044\u308b\u5834\u5408\u3001\u3044\u3061\u3044\u3061\u30e2\u30c7\u30eb\u3092\u958b\u3044\u3066\u304b\u3089\u30e2\u30c7\u30eb\u4e0a\u306e\u30b9\u30b3\u30fc\u30d7\u3092\u5168\u90e8\u958b\u304f\u306e\u306f\u7d50\u69cb\u624b\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002\u3053\u306e\u300c\u30e2\u30c7\u30eb\u4e0a\u306e\u30b9\u30b3\u30fc\u30d7\u30d6\u30ed\u30c3\u30af\u3092\u5168\u90e8\u958b\u304f\u300d\u3068\u3044\u3046\u4f5c\u696d\u3092 Simulink API \u3092\u4f7f\u3063\u3066 StartFcn \u306b\u30b3\u30fc\u30c9\u3068\u3057\u3066\u8a18\u8ff0\u3057\u3066\u3057\u307e\u3048\u3070\u3001\u30e2\u30c7\u30eb\u5b9f\u884c\u6642\u306b\u30b9\u30b3\u30fc\u30d7\u3092\u5168\u90e8\u81ea\u52d5\u3067\u958b\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306a\u30b3\u30fc\u30c9\u306f\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<pre><code>scopes = find_system(gcs,\"BlockType\",\"Scope\");\r\nfor i = 1:length(scopes)\r\n  open_system(scopes{i},\"parameter\");\r\nend<\/code><\/pre>\n<p>\u5c11\u3057\u8907\u96d1\u3067\u3059\u304c\u3001<a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/find_system.html\">find_system<\/a> \u95a2\u6570\u3092\u7528\u3044\u3066\u30e2\u30c7\u30eb\u4e0a\u306e\u5168\u3066\u306e Scope \u30d6\u30ed\u30c3\u30af\u3092\u691c\u7d22\u3057\u3001<a href=\"https:\/\/jp.mathworks.com\/help\/simulink\/slref\/open_system.html\">open_system<\/a> \u95a2\u6570\u3067 Scope \u753b\u9762\u3092\u958b\u3044\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3092 StartFcn \u306b\u66f8\u3044\u3066\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3068\u2026\u2026<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"576\" class=\"aligncenter size-large wp-image-7379\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/StartFcn-1024x576.png\" alt=\"\" \/><\/p>\n<p>\u5b9f\u884c\u6642\u306b\u3059\u3079\u3066\u306e\u30b9\u30b3\u30fc\u30d7\u304c\u958b\u304d\u307e\u3057\u305f\uff01<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30b7\u30df\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u76f4\u524d\u306b\u4f55\u304b\u6e96\u5099\u304c\u5fc5\u8981\u306a\u30e2\u30c7\u30eb\u306f\u3001StartFcn \u306b\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u81ea\u52d5\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"color: #ff6600\">\u88dc\u8db3<\/span><\/h2>\n<p>\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3059\u3079\u3066\u306e\u51e6\u7406\u3092\u305d\u306e\u307e\u307e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306b\u8a18\u8ff0\u3057\u307e\u3057\u305f\u304c\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306e\u30a8\u30c7\u30a3\u30bf\u306f MATLAB \u306e\u30a8\u30c7\u30a3\u30bf\u3068\u7570\u306a\u308a\u3001\u6587\u5b57\u306e\u8272\u5206\u3051\u304c\u3055\u308c\u3066\u304a\u3089\u305a\u88dc\u5b8c\u3082\u52b9\u304d\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u8907\u96d1\u306a\u51e6\u7406\u3092\u4f5c\u308b\u5834\u5408\u306f\u3001\u4e00\u5ea6 MATLAB \u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u3057\u3066\u4f5c\u6210\u3057\u3001\u305d\u308c\u3092\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u3059\u308b\u3068\u958b\u767a\u3057\u3084\u3059\u3044\u306e\u3067\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"554\" class=\"aligncenter size-large wp-image-7430\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/\u30b9\u30af\u30ea\u30d7\u30c8\u5316-1024x554.png\" alt=\"\" \/><\/p>\n<h1><span style=\"color: #ff6600\">4. \u7d42\u308f\u308a\u306b<\/span><\/h1>\n<p>\u4eca\u56de\u306f\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u6a5f\u80fd\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u3001\u3061\u3087\u3063\u3068\u3057\u305f\u51e6\u7406\u3092\u624b\u8efd\u306b\u81ea\u52d5\u5316\u3059\u308b\u305f\u3081\u306b\u3082\u4f7f\u3048\u307e\u3059\u3057\u3001Simulink API \u306a\u3069\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u9ad8\u5ea6\u306a\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u306b\u3082\u4f7f\u3048\u308b\u3001\u3068\u3063\u3066\u3082\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u3059\u3002\u306a\u3093\u3067\u3082 Simulink \u5074\u3067\u51e6\u7406\u3057\u305f\u3044\u3001\u3068\u3044\u3046\u65b9\u306b\u306f\u3046\u3063\u3066\u3064\u3051\u306e\u6a5f\u80fd\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u305c\u3072\u4e00\u5ea6\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30c1\u30fc\u30e0\u30e1\u30f3\u30d0\u30fc\u306b\u30e2\u30c7\u30eb\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u4f5c\u308a\u8fbc\u3093\u3060\u30e2\u30c7\u30eb\u3092\u6e21\u3057\u3066\u3042\u3052\u308c\u3070\u3001\u81ea\u52d5\u3067\u3044\u308d\u3093\u306a\u51e6\u7406\u304c\u884c\u308f\u308c\u3066\u3073\u3063\u304f\u308a\u3059\u308b\u59ff\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u3082\u2026\u2026\uff1f<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/japan-community\/files\/2022\/09\/\u884c\u3063\u305f\u308a\u6765\u305f\u308a-1024x528.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>\u7686\u3055\u3093\u3053\u3093\u306b\u3061\u306f\u3001\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u30c1\u30fc\u30e0\u306e\u9060\u85e4\u3067\u3059\u3002\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001\u300cMATLAB \u3068 Simulink \u3092\u7e4b\u3050\u300d\u3092\u30c6\u30fc\u30de\u306b\u3001\u4e3b\u306b\u6280\u8853\u7684\u306a\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002<br \/>\n\u524d\u56de\u306e\u6295\u7a3f\u306f MATLAB Expo \u5f8c\u306a\u306e\u3067\u3001\u7d04\uff13\u304b\u6708\u3076\u308a\u306e\u6295\u7a3f\u306b\u306a\u308a\u307e\u3059\u306d\u3002\u524d\u56de\u306e\u5185\u5bb9\u306f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b3\u30f3\u30c6\u30b9\u30c8\u306e\u7d39\u4ecb\u3067\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u901a\u5e38\u901a\u308a\u6280\u8853\u7684\u306a\u5185\u5bb9\u3068\u306a\u308a\u307e\u3059\u3002MATLAB \u3068 Simulink&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/japan-community\/2022\/09\/12\/model_callback\/\">read more >><\/a><\/p>\n","protected":false},"author":169,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[65,1,61],"tags":[67,69],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/7316"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/users\/169"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/comments?post=7316"}],"version-history":[{"count":25,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/7316\/revisions"}],"predecessor-version":[{"id":7433,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/posts\/7316\/revisions\/7433"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/media?parent=7316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/categories?post=7316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/japan-community\/wp-json\/wp\/v2\/tags?post=7316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}