matlabFunction: struct as parameters or automated text-replacement
1 view (last 30 days)
Show older comments
Hi!
My project simulates a mechanical model with a few parameters (length, mass, inertia matrix, etc.), which I have saved in a struct.
When I use 'matlabFunction', it requires individual scalar input parameters. This is usually fine as I can use cell-arrays to pass vectors (e.g. my state vector) as individual parameters, but how can I handle structs? The main problem is that as the project grows, some parameters are added to the parameter-struct, so e.g. cell2mat(struct2cell(struct)) will not work anymore, since the number of parameter has changed.
My question:
a) is it possible to somehow have matlabFunction accept a struct as input parameter? I thought about using symbolic variables called 'param.var1','param.var2', but this would make the code for setting up the desired expression quite ugly.
b) If it is not possible, can I automate a "find and replace" script? I would like to have a list of expressions to replace by another list of expressions, and be able to run that automatically over a file. That way, I could use matlabFunction as usual, and just have all the expressions replaced afterwards.
Thanks!
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!