Using Templates and Examples | Getting Started with Simulink, Part 9 - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 6:20
Loaded: 2.61%
Stream Type LIVE
Remaining Time 6:20
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 6:20

    Using Templates and Examples | Getting Started with Simulink, Part 9

    From the series: Getting Started with Simulink

    Save and share your model as a template so team members can access it right from the Simulink® start page. In addition, explore examples that help get you started with models for many applications.

    Published: 23 Oct 2017

    Now, I think we're ready to share this model with others. And we showed how everything, you could do that within a project. But know what you can also do is you can share this as a template within the start page itself. So can we save this as a new template for others to use? Because this is pretty generic. It's just a controller and a plant. And we had the settings all set up the way we want them set up because we had to do some of that. I don't want to have to do that again. And maybe, I don't want to have my colleagues have to do that.

    If I have to do this presentation again and I want to show a model, I might not want to start with a blank model. I might just want to open up this model as the starting point and start building it from there. So even for that purpose, I would just want to export this model as a template. And I can give this any name, basically. You can call it as a standard template. And you can also save the file name anything you want. I'll just use the same name. so that it is consistent.

    And then I can set this as a default model template. By setting that, what happens is every time I create a new Simulink model, this is not optional anymore. This would become the default starting point. So I export it. And what happens now is if I go back to MATLAB and start typing Simulink, you'll, first of all, notice that an sltx file gets created here in my current directory.

    And if I open the Start page, it shows up under my templates. If I added any description, that description would show up here in my Description. But I can then start creating new models. if I can just hit this, that would create a new model, which is a new model, which is untitled at this point. I can start working from here, rather than building it from scratch using a blank.

    And every time you click on the New Model button, there on the left, it's-- because it's not a default template, it's going to use that template every time you create it.

    Yes. But if you really don't want to do that, you want to have it as a template but maybe you don't want it to be a default, you can simply use blank model, just go and set as default. You can choose any template to be a default template.

    And you could tell which ones are default template, despite that green--

    By the orange--

    --checkmark mark over there-- sorry, green-- orange checkmark over there.

    Checkmark over there. Yes.

    OK. And one other thing, you pointed out that your template was saved in the same directory. But I would imagine that if you're sharing this template with others, you might want to--

    Yeah. You want to put that on a network drive that everybody has access to and just make sure that drive is on your MATLAB path.

    Yeah. I have seen other Simulink users create a project which just has templates, various templates, and share that project or reference that project. You can also do reference projects just like reference models. And they keep referencing all the templates in one project within their top-level project. That way, you have access to all templates in one place.

    But since we are here, I just want to point out, you can access all your recent models, your recent projects. If you have a project, you want to add to source control or retrieve from source control, you can do it straight from this page.

    Yeah. There's also examples that you can open up from the Start page, so if you don't want to open up a blank model. The templates are usually pretty basic. They're not full on examples of how to use Simulink. So this tab is great, has a number of nice examples.

    Nice applications. This one, it shows a complete control plan model for a fault-tolerant fuel control system. There a good documentation. you can read. When you hit Learn More, it takes you to the documentation a lot of information of what this model does. But you can simply open up the example 2, which opens up the Simulink model, which has access to all the-- the way this system is set up, it has a control loader. It has a plant, and it has various signals coming in.

    It also has a dashboard--

    Oh, yes.

    --in here now. Yeah, this is, essentially, a front end UI for the model. We showed one piece of this in the model that--

    We built?

    --we're building, which is just a dashboard scope on the bottom. But if you run the simulation, this dashboard is actually connected to the pieces of the model. So you can control, for example, the engine speed and switch it from 300 to 700. All it's doing there is it's changing the value of a constant block from 300 to 700. But instead of somebody having to go into the constant block, open up the dialog box, manually type in 300, 700, this is a much easier way to do that.

    Yeah. One use case I can think of is the calibration engineers, who might not want to mess up with some of the values within the Simulink model. Rather, they would just open up this and have a visual sense of how the model is behaving. for various parameters.

    Yeah, or you just hand it off to anybody who you want them to simulate your model. But they don't know about all the inner workings of how the model behaves. And this is just an easier way to access all that.

    Yeah. So we have seen just one example. But yeah, this is an example, so I cannot save it. So I'll just leave it as it is. I don't want to mess with it. And you can access several such examples. and not just within Simulink, but all the products that you have access to with their license. You can just access it.

    Related Products

    View more related videos