Calling SimMechanics which requires input variables from matlab function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am calling my simMech model from my matlab function using sim('mymodel.mdl') in a matlab function file. Only problem is that the model cannot run because I need it to take parameters that are defined in my function (e.g. initial conditions on a joint is specified as 'jointIC' in the simMech model and in my matlab function I have jointIC = 0;) Furthermore I need to pass the outputs of the model back to my function.
I know that you can do what I have described for script files in matlab i.e the variables are passed back and forth from the matlab workspace. But in my case it is very important that I pass them via my function!
Any input would be appreciated, thanks!
3 comentarios
Walter Roberson
el 2 de Nov. de 2012
The tags should be descriptive of the problem to be solved; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Respuesta aceptada
Kaustubha Govind
el 30 de Oct. de 2012
You need to pass in some additional options to the SIM command to make sure that the model reads and writes to the function workspace instead of the base workspace.
options = simset('SrcWorkspace','current', 'DstWorkspace', 'current');
sim('mymodel.mdl', options);
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!