{"id":17948185,"url":"https://github.com/gave92/matsim","last_synced_at":"2025-10-13T21:38:33.569Z","repository":{"id":38612234,"uuid":"143908390","full_name":"gave92/Matsim","owner":"gave92","description":"  Matlab/Simulink interface. Easily create Simulink models from a Matlab script.","archived":false,"fork":false,"pushed_at":"2020-07-13T19:50:32.000Z","size":1436,"stargazers_count":19,"open_issues_count":2,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T23:23:04.154Z","etag":null,"topics":["matlab-script","matlab-simulink"],"latest_commit_sha":null,"homepage":"https://it.mathworks.com/matlabcentral/fileexchange/68436-matsim","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gave92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-07T17:51:08.000Z","updated_at":"2025-01-29T16:25:07.000Z","dependencies_parsed_at":"2022-09-12T16:10:34.283Z","dependency_job_id":null,"html_url":"https://github.com/gave92/Matsim","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gave92/Matsim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gave92%2FMatsim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gave92%2FMatsim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gave92%2FMatsim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gave92%2FMatsim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gave92","download_url":"https://codeload.github.com/gave92/Matsim/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gave92%2FMatsim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017048,"owners_count":26085951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matlab-script","matlab-simulink"],"created_at":"2024-10-29T09:02:24.388Z","updated_at":"2025-10-13T21:38:33.525Z","avatar_url":"https://github.com/gave92.png","language":"MATLAB","funding_links":["https://www.paypal.me/gave92"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://gave92.github.io/Matsim/\"\u003e\n    \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/matsim-logo.png?raw=true\" width=\"170\" /\u003e\n  \u003c/a\u003e\n\n  \u003ch3 align=\"center\"\u003eMatsim\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    A sleek, intuitive interface for building Simulink models from a Matlab script.\n    \u003cbr\u003e\n    \u003ca href=\"https://gave92.github.io/Matsim/\"\u003e\u003cstrong\u003eExplore Matsim docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://github.com/gave92/Matsim/issues/new?template=bug_report.md\"\u003eReport bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/gave92/Matsim/issues/new?template=feature_request.md\u0026labels=enhancement\"\u003eRequest feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\nMatsim is a high level interface to create Simulink models from a [Matlab](https://www.mathworks.com/) script. Matsim is a wrapper around the standard [simulink API](https://it.mathworks.com/help/simulink/ug/approach-modeling-programmatically.html) that makes building a simulink model programmatically much faster.\n\n[![View Matsim on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://it.mathworks.com/matlabcentral/fileexchange/68436-matsim)\u0026nbsp;![logo](https://img.shields.io/badge/license-MIT-blue.svg)\u0026nbsp;[![donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/gave92)\n\n\n## Key features\n* **Automatic layout** (no need to specify block positions!)\n* **Intuitive interface** (you can \"add\", \"subtract\", \"multiply\", ... simulink blocks)\n* **Extensible library** (easily add new blocks from your custom libraries)\n\n| \u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;Source\u0026nbsp;script\u0026nbsp;(.m)\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; |  Resulting model | Notes |\n:-------------------------:|:-------------------------:|:-------------------------:\n`c = Constant(1)` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_1.PNG?raw=true\" height=\"80\" /\u003e | Create a Constant block with value 1\n`res = a+b` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_2.PNG?raw=true\" height=\"80\" /\u003e | Create an Add block and connect its inputs to blocks `a` and `b`\n`res = [a,b]` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_3.PNG?raw=true\" height=\"80\" /\u003e | Create an Mux block and connect its inputs to blocks `a` and `b`\n`res = Max(a,b)` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_4.PNG?raw=true\" height=\"80\" /\u003e | Create an MinMax block and connect its inputs to blocks `a` and `b`\n`res = 1 - u1./(u2.*u3)` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_5.PNG?raw=true\" height=\"80\" /\u003e | Create a group of simulink blocks that computes a complex expression\n`Scope(Gain(FromWorkspace('var'),'Gain',0.5))` | \u003cimg src=\"https://github.com/gave92/matsim/blob/master/docs/images/readme/readme_6.PNG?raw=true\" width=\"150\" /\u003e | Easily combine blocks\n\n## Installation\n\nThe automatic layout feature relies on [GraphViz](https://www.graphviz.org/), which you need to install separately.\n\n1. Install [GraphViz](https://www.graphviz.org/download/) and add it to the system PATH\n2. Download and extract the Matsim package (from [File Exhange](https://it.mathworks.com/matlabcentral/fileexchange/68436-matsim) or from here)\n3. Add Matsim folder (and subfolders) to the Matlab path\n\n## Quick guide\n\nQuick example to get started. For more check the [tests](https://github.com/gave92/Matsim/tree/master/tests) folder.\n\n#### 1. Create or load a simulink model\n\n```matlab\nimport matsim.library.*                       % Import Matsim package\n\nsys = simulation.load('my_model');            % Create or load a model named 'my_model'\nsys.setSolver('Ts',0.01,'DiscreteOnly',true)  % Set solver for the model\nsys.clear()                                   % Delete all blocks\nsys.show()                                    % Show the model\n```\n\n#### 2. Create blocks\n\n```matlab\nVx = FromWorkspace('V_x');                    % Add FromWorkspace and Constant blocks\nWr = FromWorkspace('W_r');\nRr = Constant(0.32);\n\nslip = 1 - Vx./(Wr.*Rr);                      % Evaluate complex mathematical expression\nsys.log(slip,'name','slip')                   % Log the output of the \"slip\" block\n\ns = Scope(slip);                              % Create and open scope block\ns.open()\n```\n\n#### 3. Connect and layout the model\n\n```matlab\nsys.layout()                                  % Connect and layout the model\n```\n\n#### 4. Simulate the system\n\n```matlab\nV_x = [0:0.1:10;linspace(5,20,101)]';         % Define input variables\nW_r = [0:0.1:10;linspace(5,23,101)/0.32]';\nsimOut = sys.run('StopTime',10).Logs;         % Simulate the system\n```\n\n© Copyright 2017 - 2019 by Marco Gavelli\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgave92%2Fmatsim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgave92%2Fmatsim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgave92%2Fmatsim/lists"}