Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

What is the best practice for passing data to use for visualization?

1 visualización (últimos 30 días)
sloppydisk
sloppydisk el 21 de En. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
What is the best practice for passing variables to a function for visualization?
I am working on a simulation of a flexible mechanism. Currently I have my script set up to run roughly in 4 files:
  • input_params.m defines parameters for a specific problem, this file in turn calls ode_sim.m with these parameters as a struct.
  • ode_sim.m finds output variables like y_out, u_out, t_out etc. from an ode simulation, this file then calls kinematics.m and visualize.m
  • kinematics.m constructs the other relevant output variables like the material points p_mat from y_out, u_out etc. as arguments
  • visualize.m then takes a bunch of arguments y_out, u_out, p_mat to visualize them in plots and animations
Now when I have finished my simulation I would like to be able to change the visualization only and rerun it without redoing the simulation, currently this is not possible, because the input variables for visualize.m are passed from the workspace of the function ode_sim.m, which is not accessible from the command window. To change my code to have that possibility there are a bunch of options, two of which are:
  • Save the data in a .mat file and load the variables from that in visualize.m
  • Save the data in the workspace of input_params.m and run visualize.m there (this would work only if ode_sim.m was run earlier this session)
Which of these would be the most accurate way of structuring my code or do you know of a better way?

Respuestas (0)

Productos


Versión

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by