Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

MATLAB: How do you simulate a simulink model using a string?

Options
  • 26-11-2010 4:51pm
    #1
    Registered Users Posts: 61 ✭✭


    Hey guys can you please help with this, I just cant get it.

    I have a simulink model with the name BusAssignment and with that I have an edit box inside a GUI with a string BusAssignment. I am trying to get the mfile to read the String and simulate it as it is the name of the simulink model.

    At the moment I have the follow piece of code for that section


    SimulinkName = get(handles.simulinkname, 'String'); %takes the simulink model name

    sim(SimulinkName) %runs the simulink model


    SimulinkName gives back BusAssignment but when it goes to sim it trys to simulate SimulinkName which is not right and give this error:

    ??? Error using ==> GUIForProject>student_SelectionChangeFcn at 1280
    Unable to open file for reading: "SimulinkName.mdl".

    For it to work I need it to do the following

    sim('BusAssignment')



    Any suggestions?


Advertisement