How to automatically add/subtract lines of code into a matlab function for several iterations?

4 ビュー (過去 30 日間)
Rachel Dawn
Rachel Dawn 2020 年 10 月 20 日
編集済み: Stephen 2020 年 10 月 20 日
So, I have this topology optimization function (models a beam problem with supports/loads on it).
It takes 5 input variables and generates an image of a certain topology.
I know how to randomly generate different #s for the 5 input variables to create different topologies.
But, there's some lines in the function code that work to apply one load at the end of the beam.
I want to be able to automatically change this part of the code so that the code will randomly choose between 1-2 applied loads and each at different random locations. This way, I can generate different topologies based off how many/where loads are applied
How would I go about this?
I was given the following advice, but don't really understand what was meant by this/ how to implement input files:
  • Automate the code, set up input files to iterate through, different input file for loads at different locations or volume constraints, etc.
  • Change the code so that instead of all values being embedded within code, everything u want to get changed is through input file, automate thru and rewrite input file over and over again
  6 件のコメント
Stephen 2020 年 10 月 20 日
@Rachel Dawn: fair enough, thank you for the explanation. Good luck with your task!


回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by