Modelling A Matlab Project
Mostrar comentarios más antiguos
Hello.
I have recently written a Matlab project which basically just contains a lot of different mathematical functions/processes, however it can be difficult to read/follow at times and in future work, expanding will most likely add to the complexity. I therefore had a thought about trying to model the project somehow; at first I tried using Simulink and the Matlab function blocks to better represent the flow of data, however I ran into several problems i.e. unable to parse strings, cells, calling external functions etc.
Does anyone have any suggestions as to possible ways to create models from existing code in a way to be more user friendly to follow the flow of data?
Many Thanks,
Ross
4 comentarios
Rik
el 17 de Feb. de 2018
I don't use a Simulink model, but instead rely on extensively commenting my code, writing documentation for main functions, as well as sub-functions, and try to keep the names of my variable clear, concise and meaningful. To this date that has been enough.
Switching to Simulink has major drawback: you need additional licenses, so you reduce the number of people who can use your code and the number of people who might help you solve issues.
For me personally, using sub-functions and comments is enough to follow the program flow, even for older projects I haven't touched in a while.
(Because 'just try harder'/'do it my way, you silly' is not very helpful most of the time (or plain arrogant), I chose to add my thoughts as a comment, instead of an answer.)
Ross
el 17 de Feb. de 2018
Rik
el 17 de Feb. de 2018
I once had a teacher for a basic Java programming course that had a very strong opinion that programming should start with drawing a flowchart. He even went so far that he would rather hand in his computer than his whiteboard. So, absolutely, a picture can clarify a lot, but in this case I would use the flowchart for the actual programming. Good luck, and have fun with your project :)
(I do think this question is appropriate for this website, even without a definite answer. Closing it will prevent people from seeing this and makes it impossible for people in the future to add their thoughts. Consensus might move in the future as well, hence my reopening of the question. If you want to I can move my comment to the answer section so you can accept it (or you could accept the answer by aveek or add your own), but I don't think a single accepted answer is the best strategy for this topic.)
Respuestas (1)
Aveek Podder
el 19 de Feb. de 2018
0 votos
Hi,
Stateflow is an environment for modeling and simulating combinatorial and sequential decision logic based on state machines and flow charts. Stateflow lets you combine graphical and tabular representations, including state transition diagrams, flow charts, state transition tables, and truth tables, to model how your system reacts to events, time-based conditions, and external input signals.
Please have a look at the following link:
Categorías
Más información sobre Interactive Model Editing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!