Guy on Simulink

Simulink & Model-Based Design

Guy on Simulink Material on GitHub and MATLAB Online

I decided to try adopting this new feature to open GitHub repositories directly in MATLAB Online. That way, you will now be able to open my blog posts and related files in MATLAB Online in one click. As described by Mike, this will work even if you don't have a MATLAB license, all you need is a free MathWorks account.
Let's see how this works.

A GitHub repository for Guy on Simulink material

To make it easier for you to reproduce what I am covering on this blog, I created a GitHub repository: github.com/simulink/blog
For each post, I will add a folder in the repository with the MATLAB live script I used to create the post, along with all MATLAB scripts, functions, Simulink models, and other files I used while writing the post. In the above screenshot, you can see the folder for my previous post on debugging custom C/C++ code. More folders will be added as new posts gets published.
In case anyone is wondering, I use the Publishing tool for MATLAB® live script to WordPress to publish posts on this blog.

Opening Blog Posts in MATLAB Online

Did you notice the Open in MATLAB Online badge at the end of my last blog post?
If you click on the link the following will happen:
  • MATLAB Online will open and ask you to log in using your MathWorks account
  • The MATLAB live script will open in the MATLAB Editor, ready for you to read, execute, and modify.
This should make it easy for you to try and modify my examples directly in your web browser.
In case you would like to do the same with your GitHub repositories, the way to create the URL to open any GitHub repository in MATLAB Online is documented here: Open in MATLAB Online from GitHub.

A Simulink Example

It would be sad to end this post without at least opening and simulating a Simulink model. Here is a simple mass-spring-damper model:
mdl = 'ex_modeling_simple_system';
open_system(mdl);
Here is what the model looks like in MATLAB Online:
We can simulate it:
in = Simulink.SimulationInput(mdl);
out = sim(in);
and look at the results in the Simulation Data Inspector, which opens in a separate tab.
plot(out)

Now it's your turn

Start right now and open this blog post in MATLAB Online:
I hope you will like this new way to easily access all the files needed to reproduce my blog posts.
|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。