How to simulate a model through App Designer, set parameters and plot outputs in App Designer?

Поділитися
Вставка
  • Опубліковано 27 гру 2024

КОМЕНТАРІ • 95

  • @rebaonereba4213
    @rebaonereba4213 Рік тому +1

    Thank you so much. I’m currently building a learning tool for Power electronics course using Matlab app designer 😅. This was quite helpful.

  • @nathanseba270
    @nathanseba270 2 роки тому +1

    Tank you very much you help me for my internship when I'm blocked since 3 days

  • @wisienkowykompot3649
    @wisienkowykompot3649 Рік тому +1

    great tutorial thank you very much from the bottom of my heart

  • @TudorMiron
    @TudorMiron 2 роки тому +1

    Thank you for this tutorial. It was helpful.

  • @chrisdeprosperts1065
    @chrisdeprosperts1065 5 років тому +1

    Very useful introduction! Having achieved part of my work based on your sharing. Thank you

  • @sunilgiri7718
    @sunilgiri7718 4 роки тому +1

    Thank you for the enlightening video. It is very useful for creating an integrated Simulation environment with App designer.

  • @heyderlargo9204
    @heyderlargo9204 3 роки тому +1

    Thank you so much! Very helpful video.

  • @prasadadavi6618
    @prasadadavi6618 3 роки тому +1

    Fabulous 👍

  • @atharvabodhe205
    @atharvabodhe205 Рік тому

    I am trying to get the output of a frequency v/s time graph from simulink to the app UIAxes. It is giving me error of "Dot indexing is not supported for variables of this type." Sir, can you please explain to me what this error is? This is the code I am using. 'graph' is the name for "to workspace" block
    simOut = sim('sim_model');
    time = simOut.graph.time;
    frequency = simOut.graph.data;
    plot(app.UIAxes, time, frequency);

  • @TudorMiron
    @TudorMiron 2 роки тому

    I'd like to ask a question. I created a complex multibody vehicle model in simulink. It outputs lots of data (via to Workspace) and initially I was analyzing results in MatLab. Now I want to build an App to interact with the model - vehicle setup adjustments etc. I read the results from MatLab to app via evalin command (x_parameter=evalin('base','Res.Chassis.F_Axle.etc, etc. Res. being simout timeseries with simulation results). All worked fine till I decided that I want to add a simple possibility to run the model from this app. If I initialize/run the model from App than it doesn't write the results to base workspace. If I would run it from Simulink - than it does, from App it doesn't... May be this is the way it should be but than how do I access results considering that it's a large amount of channels?

    • @МаксимФедосов-ж8ъ
      @МаксимФедосов-ж8ъ 2 роки тому

      same problem

    • @ProgrammerWorld
      @ProgrammerWorld  2 роки тому

      When you run the Simulink model from the App then by default all the data gets output to function workspace and not base workspace.
      To access the data, you would have to use "caller" parameter instead of "base" in your evalin command.
      (x_parameter=evalin('caller', Res.Chassis.F_Axle')
      Other option is to use ASSIGNIN command to transfer the data from function to base worksapce.
      assignin('base', 'Res.Chassis.F_Axle', Res.Chassis.F_Axle_base)
      Hope above helps.
      Cheers
      Programmer World
      programmerworld.co
      -

    • @TudorMiron
      @TudorMiron 2 роки тому

      @@ProgrammerWorld Many thanks for your reply! I will be able to try it out in a couple of days and will report here. Thank you!

  • @smilesmile787
    @smilesmile787 3 роки тому +1

    This video very good

  • @raula.6072
    @raula.6072 6 років тому +2

    Nice video! However, I wonder if there's a command that actually lets me see the change in the plot instantly as soon as I change the value in the slide bar, so as to make it more real and interactive. Thanks in advance!

    • @ProgrammerWorld
      @ProgrammerWorld  6 років тому +1

      It is possible to design the GUI such that the changes are reflected instantly in the plot.
      For this you simply have to add callback function (value change callback) to the slide bar. And in this call back function rewrite the plot command for the axes. This will refresh the plot immediately for any value change of the slide bar.

  • @angelleal3005
    @angelleal3005 3 роки тому

    Can the app designer be used for real time sensor readings ?

  • @sriravalikamthamraju6225
    @sriravalikamthamraju6225 4 роки тому +1

    thank you so much ! this is so helpful !

  • @tosddk7758
    @tosddk7758 3 роки тому

    Thanks for the video, I would like to know if I would to compile the app to a standalone app for someone else to use, how does the simulation model from Simulink works for them ?

  • @yasonthayanithi6372
    @yasonthayanithi6372 2 роки тому

    Hello, I am keep getting this error - Unrecognized field name "Time". & Dot indexing is not supported for variables of this type. What is the reason? I am using R2021b.

  • @devikamahajan4365
    @devikamahajan4365 3 роки тому

    Hi, I would like to know if its possible to run an App designed in App designer which is running in one session of matlab and simulink model is running in 2nd session of matlab. I want to form a communication link between the two. Could you please help me.

    • @ProgrammerWorld
      @ProgrammerWorld  3 роки тому

      To communicate between 2 different sessions of Matlab, you will have to build some kind of communication channel between the two based on IP protocol. It can be done using Java class for communication.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @javierhidalgoescalante3146
    @javierhidalgoescalante3146 4 роки тому

    Hi... I want to set a parameter in a A/C source from an entry of an user in AppDesigner, but wen I do it Matlab says " A/C Source don't exist 'Peak amplitude' parameter'", do you know hoe can I call that parameter?
    This ir what 'm doing:
    set_param('SimulinkName/BlockName' , 'Peak amplitude' , app.Vs.Value);
    (app.Vs.Value is the value from the user un AppDesigner)...
    This is the matlab error msg:
    Error using SimulinkName/CacularButtonPushed (line 60)
    AC Voltage Source block (mask) does not have a parameter named 'Peak amplitude'
    Do you know the correct name to this parameter? Thanks a lot for the help that you can bring me....

  • @gabrielmq9462
    @gabrielmq9462 3 роки тому +1

    Me sirvió muchísimo su video, graciasss

  • @sunilgiri7718
    @sunilgiri7718 4 роки тому

    Hi,
    Can you please suggest me the way to display the Organization Logo in the MATLAB App designer window. Let's say for an instance, I have developed a GUI for Integrated Simulink Environment with App designer and as soon as I click on Start button, my output figures and other results appear in the App designer window. So along with that I want to display the logo as well.
    P.S - I know this can be done easily by using the release R2018b and onwards, But I am using MATLAB R2017b version.
    Thanking you in Anticipation.

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому +1

      I think you can simply use image button to show the image in your App developed in App designer in R2017b.
      Please refer to my below video for the same:
      ua-cam.com/video/3IQMZQ7JBn0/v-deo.html
      Good Luck
      Programmer World
      programmerworld.co
      -

    • @sunilgiri7718
      @sunilgiri7718 4 роки тому +1

      @@ProgrammerWorld - Thank you so much, I didn't know this could be done so easily. Keep uploading nice and informative videos on such topics. 👍👍

  • @ayushvarun1425
    @ayushvarun1425 Рік тому

    will the plot function work for live graphs(i mean the graphs which takes time to get plotted in simulink model)....plzzz reply

    • @ProgrammerWorld
      @ProgrammerWorld  Рік тому

      No, in progress simulation data cannot be plotted in the App designer, because in the below "simout" will get the values once the simulation is finished:
      simout = sim(‘SineWave_SL’, ‘StopTime’, num2str(app.DurationSlider.Value));
      Which is further used to plot using the below command:
      plot(app.UIAxes, simout.SineWaveValue.Time, simout.SineWaveValue.Data);
      For reference, details shown in this video is also shared in the below link:
      programmerworld.co/matlab/simulate-a-model-through-app-designer-set-parameters-and-plot-outputs-in-app-designer/
      Cheers
      Programmer World
      programmerworld.co
      -

    • @ayushvarun1425
      @ayushvarun1425 Рік тому

      @@ProgrammerWorld so do u mean I will get the plot on the app designer only after the graph is completed in the scope block(it takes around 800 sec for the simulation to complete )??? Plzzz reply I really need help

    • @ProgrammerWorld
      @ProgrammerWorld  Рік тому

      Yes, plot will come in app designer after the simulation completes.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @vincevenice1333
    @vincevenice1333 4 роки тому

    Hey I just wanted to know that can we use external button to start any program in app designer?
    Thank you for your help

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому

      Yes, why not ... Just in the call back method of the button put the right API to be called.
      Good Luck
      Programmer World
      programmerworld.co
      -

    • @vincevenice1333
      @vincevenice1333 4 роки тому

      @@ProgrammerWorld Thank you for your reply But in the button call back either the value is for changed or changing of the button but I want to change the state by pressing external button. Do I need to put the API for that?

  • @ayushvarun1425
    @ayushvarun1425 Рік тому

    Can you plzz tell me how can we import data from excell to from_workspace block in simulink model....can we do it using assignin function...plzz reply

  • @adarshmishra6379
    @adarshmishra6379 6 років тому

    I want to create a BUTTON on GUI, so that when I click on it some new buttons, texts and plots appears (which were not displaying earlier when I had not clicked on that BUTTON). How can I do this?

    • @ProgrammerWorld
      @ProgrammerWorld  6 років тому

      This can be done easily. You will have to change the visibility flag of the buttons you want to control in the callback functionality.

    • @adarshmishra6379
      @adarshmishra6379 6 років тому

      Programmer World thanks!

  • @ayushvarun1425
    @ayushvarun1425 Рік тому

    does set_param function do the same function as assignin function ....if no,can u plz provide the code for the same simulink model using set_param function....plzz reply to this

    • @ProgrammerWorld
      @ProgrammerWorld  Рік тому

      No set_param and assignin are different functions.
      Instead of this:
      assignin(‘base’,’Ampl’,app.AmplitudeSlider.Value);
      You can try this:
      set_param('SineWave_SL', 'Ampl', app.AmplitudeSlider.Value)
      It should work.
      For reference, details shown in this video is also shared in the below link:
      programmerworld.co/matlab/simulate-a-model-through-app-designer-set-parameters-and-plot-outputs-in-app-designer/
      Cheers
      Programmer World
      programmerworld.co
      -

  • @adrianivanov6626
    @adrianivanov6626 5 років тому

    Is there any way that i can design a GUI that uses a model generated by Regression Learner app to make predictions using data the user inputs in the GUI? I tried using the modelname.predictFcn() function in Appdesigner code but, since I am a beginner, I can't seem to make it work.

    • @ProgrammerWorld
      @ProgrammerWorld  5 років тому

      Hi,
      There should be no reason for your predictFcn command to not work in the App designer code. Of course I assume you have the necessary toolboxes 'Statistics and Machine Learning Toolbox' installed on your machine.
      Now, if you could have provided the error message you are observing then it would have helped to evaluate the reason behind the failure. However, one reason could be the variables are not present in the App workspace. To explain it further, let's assume you have created your trained model in the base workspace of matlab and trying to access the same from the App code then it won't work as the variable is not present in the App workspace. You will have to use ASSIGNIN or EVALIN command to do the respective adaptation of the workspace variables.
      If above does not helps to resolve your query then please copy the error message here. Then probably I can evaluate it better.

    • @adrianivanov6626
      @adrianivanov6626 5 років тому

      @@ProgrammerWorld This is the error message: Undefined variable "modelh2s" or class "modelh2s.predictFcn". I suppose you are right about using ASSIGNIN or EVALIN, but I am not smart enough to use them. Could you help me a bit more with explaining which one to use and how? I have read the syntax for both these commands, but I find them confusing.

    • @ProgrammerWorld
      @ProgrammerWorld  5 років тому

      From the error message it is very clear that the issue is that the variable is not present in the App Designer workspace. I assume you created your predictive model in the base workspace, so the variable "modelh2s" exists only in base workspace.
      To access the variable from the base workspace into your local (App Workspace), you can use the below command. This should create a variable "modelApp" in the local workspace.
      modelApp = evalin('base', 'modelh2s');
      I hope the above helps you in resolving your issue.

    • @adrianivanov6626
      @adrianivanov6626 5 років тому +1

      @@ProgrammerWorld In my country we have a saying: when you're stupid, life is also hard. I have been trying to get my head around this for a few days now. Thank you for making my life a little easier. I ended up using evalin to create the modelApp with a struct insted of a function. Works perfectly!! This is the piece of code i wrote: function ButtonPushed(app, event)
      modelApp=evalin('base','modelPredictieh2s');
      a=app.amineEditField.Value;
      b=app.swsEditField.Value;
      array2table(a);
      array2table(b);
      c=horzcat(a, b);
      d = modelApp.predictFcn(c);
      app.rezEditField.Value = d;
      end
      Thank you so much!

    • @adrianivanov6626
      @adrianivanov6626 5 років тому

      @@ProgrammerWorld Here I am, returning to you. After using evalin with success, I have tried compiling my app as a standalone. The GUI loads, but the calculation does not. I am guessing it is because evalin? Is there any otherway to load the .mat file I need into the code so that it works in standalone version? I have tried to make a simpler GUI and deploy it as standalone and it worked, so there is no problem with the compiler

  • @mdjamirhossainjamir428
    @mdjamirhossainjamir428 Рік тому +1

    thank you vary so masuh

  • @coffeeover
    @coffeeover 4 роки тому

    非常感谢您的视频

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому +1

      别客气
      Cheers
      Programmer World
      programmerworld.co
      -

  • @sarthakrawat655
    @sarthakrawat655 6 років тому

    Can we create a pushbutton to browse .Data file or upload excel sheet and it as an input to simulink to simulate ?? Please help me on this

    • @ProgrammerWorld
      @ProgrammerWorld  6 років тому

      You can do this easily by using XLSREAD command for getting data from excel sheet. For other files you can use fopen, fscanf, fgets, fread, etc command to browse the data.
      Use above command in the callback of your pushbutton. Extract the data in some local variable. And then use this local variable to pass the input to the Simulink model. You can exchange the data through base workspace using the assignin command as shown in my video presentation. And of course you can simuate your model from your gui using sim which is also shown in the video presentation.

    • @sarthakrawat655
      @sarthakrawat655 6 років тому

      @@ProgrammerWorld
      Thanks a lot sir your video helped me alot
      Also I want to ask if there is any other way to hide a plot after pushing a button
      I used app.plot.Visible='Off'
      It worked the axes were hidden but the plot was still visible I cannot hide the plot

    • @ProgrammerWorld
      @ProgrammerWorld  6 років тому

      I think what you are looking here is 'cla' command. So, calling cla(app.UIAxes) should clean up your axes with any plots your have drawn on it. Then you can call your app.UIAxes.Visible='off' to hide the axes itself.
      Good Luck
      PW!

    • @sarthakrawat655
      @sarthakrawat655 6 років тому

      Thanks alot

    • @sarthakrawat655
      @sarthakrawat655 6 років тому

      @@ProgrammerWorld sir I tried but I couldn't do it
      If it's possible could you please make a video on this topic??

  • @ouafaeer-rachedy8078
    @ouafaeer-rachedy8078 2 роки тому

    how can I define stop time in inf

    • @ProgrammerWorld
      @ProgrammerWorld  2 роки тому

      Below will work:
      simout = sim('SineWave_SL', 'StopTime', 'inf');
      Also, simulating the model just with the model name as in below will take the stop time from the configuration of the model.
      simout = sim('SineWave_SL')
      So, if in the model configuration the simulation time is set to inf, the model will simulate to infinity.
      Please note: when simulating a model with infinite stop time, to stop the simulation, you must press Ctrl+C. Ctrl+C breaks the simulation, however, the simulation results are not saved in the MATLAB workspace.
      For reference, the complete source code shown in this video is also shared in the below link:
      programmerworld.co/matlab/simulate-a-model-through-app-designer-set-parameters-and-plot-outputs-in-app-designer/
      Cheers
      Programmer World
      programmerworld.co
      -

    • @ouafaeer-rachedy8078
      @ouafaeer-rachedy8078 2 роки тому +1

      @@ProgrammerWorld thank u so much

    • @ouafaeer-rachedy8078
      @ouafaeer-rachedy8078 2 роки тому

      I need to plot more than out how can I do it because i try it but i have a errour: data cannot have more than 2 dimentions

    • @ProgrammerWorld
      @ProgrammerWorld  2 роки тому

      @@ouafaeer-rachedy8078 You can use plot3 for plotting 3 dimensional points.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @rolanossi3275
    @rolanossi3275 4 роки тому

    let me thank you for this useful explanation.
    But when I tried to convert it to an.exe application using Standalone app, the generated software was not plotting the data.
    Any idea sir?

    • @ProgrammerWorld
      @ProgrammerWorld  3 роки тому +1

      This App Designer GUI uses a Simulink model to simulate and plot the data. So, I am not sure, but please check if the model file (.slx file) is included while creating the .exe application. If the model file is not available then the App will not be able to plot as it will not get the data.
      I hope above clarifies and helps.
      Just for reference, the complete code shown in this tutorial is also shared in the below page:
      programmerworld.co/matlab/simulate-a-model-through-app-designer-set-parameters-and-plot-outputs-in-app-designer/
      Cheers
      Programmer World
      programmerworld.co
      -

  • @siddheshr7885
    @siddheshr7885 5 років тому

    Excellent Video !! I am trying to display video in GUI, can you tell how to do it?

    • @ProgrammerWorld
      @ProgrammerWorld  5 років тому

      Please watch my below video. In this it is shown how to get webcam video in gui using Matlab app designer.
      ua-cam.com/video/xp3KtoWaGX8/v-deo.html

  • @SanjeevKumar-ib7ei
    @SanjeevKumar-ib7ei 5 років тому

    Nicely explained!!
    Sir, is there any way to change amplitude/frequency in run time...??

    • @ProgrammerWorld
      @ProgrammerWorld  5 років тому +1

      Parameters values such as amplitude or frequency can be set in the workspace or sim command. However, once set the values cannot be changed for the simulation in progress. So, in order to change the parameter values, you may have to stop any previously running simulation and restart the sim command with updated values.
      I hope this answers your question.

    • @SanjeevKumar-ib7ei
      @SanjeevKumar-ib7ei 5 років тому

      @@ProgrammerWorld Thanks for prompt response!!
      It clarified my doubt and what I understood that we can't send /receive parameters while model is running. If you found any way to do this plzz let me know.

  • @aykutsirma4260
    @aykutsirma4260 4 роки тому

    Nice information. Is it possible to show us a real time plotting in the graph too please? For example, we get serial data from arduino - serial port and plot it in real time with App Designer? thank you.

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому +1

      I do not have a video on Arduino as of now. However, in my below video it shows how to capture live video from the webcam and display it in the App Designers. You may refer to it:
      ua-cam.com/video/xp3KtoWaGX8/v-deo.html
      Cheers
      Programmer World
      programmerworld.co
      -

    • @aykutsirma4260
      @aykutsirma4260 4 роки тому

      @@ProgrammerWorld friend, I have more question. I have an AXES component graph, and I want to change its x or y axis' maximum value with slider component which when I change the slider value then graph's x or y axis maximum value will be changed too. How can we apply such feature?
      app.UIAxes.XLim = [0 app.hx711yAxisSlider.Value]; I write this line of code but on the App Designer GUI, when I change the slider value - the x axis maximum value is not changing, which it is not updating.
      I will be very glad if you would guide me, thank you very much.

  • @darshankannur3682
    @darshankannur3682 5 років тому

    Sir please tell me how to change input parameters in simulink through app designer only.. ?

    • @ProgrammerWorld
      @ProgrammerWorld  5 років тому +1

      An example of changing parameters from App designer is shown in this video. Check line number 18 of my code. The amplitude value of sine wave is set in the App designer which is used in Simulink model.

    • @darshankannur3682
      @darshankannur3682 4 роки тому

      @@ProgrammerWorld Thank you so much sir.
      Sir please make a video on making a app standalone when the app is depending on simulink file and simulink is depending on excel sheet connected to it.

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому

      @@darshankannur3682 Hi,
      In this video it very nicely shows the interaction between App designer and Simulink model. It gives inputs to the Simulink from App designer and displays the output of Simulink model in App designer. However, if you want to have an interaction or dependency with the Excel sheet, then you can refer to my below videos.
      In the below video it shows how you can enable traceability between the Excel sheet and Simulink model:
      ua-cam.com/video/74T8RWyIbPs/v-deo.html
      In the below video it shows how you can export the Simulink data to an Excel sheet:
      ua-cam.com/video/P6LycAJmw3M/v-deo.html
      Hope above helps.
      Cheers
      Programmer World
      programmerworld.co
      -

    • @darshankannur3682
      @darshankannur3682 4 роки тому

      @@ProgrammerWorld yeah sir I have already did the excel part using from spreadsheet block. But Sir I want to know how make an app stand alone desktop app. When it is in interface with simulink and excel. I tried but app is not running. I think I have missed links and files. Can u please make a video on that..
      Thank you in advance. ☺

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому

      @@darshankannur3682 OK, thanks for detailed input. So, basically the requirement is to have a standalone desktop application which can interact with an excel sheet and Simulink model.
      I will try to make a tutorial on above topic and will let you know once I post it. Thanks again.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @abhijeetkibe5901
    @abhijeetkibe5901 4 роки тому

    Hello sir excellent video, can you please help me...I want to translate( in x,y,z) 3d geometries using GUI of app designer...

    • @ProgrammerWorld
      @ProgrammerWorld  4 роки тому

      Can you please be a bit more specific? You want to translate the the coordinates in to what object?
      Anything which can be done in Matlab script can be done in App designer. So, details will help me to understand your objective here.
      Cheers
      Programmer World
      programmerworld.co
      -

  • @suba.2850
    @suba.2850 Рік тому +1

    thank you so much sir. i have question. can i email you?

    • @ProgrammerWorld
      @ProgrammerWorld  Рік тому

      For any questions, suggestions or appreciation please contact us at: programmerworld.co/contact/ or email at: programmerworld1990@gmail.com