How to change the variable name after each run
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
Let's say I have two variables SSD and GND. After I hit the run button for the first time, the program will run and give me the value of SSD1 and GND1. But after the 2nd run, it will give me SSD2 and GND2. After 3rd run, SSD3,GND3. And this will go on. How can I do that?
0 个评论
回答(1 个)
Steven Lord
2023-2-16
Can you dynamically create variables with numbered names like x1, x2, x3, etc.? Yes.
Should you do this? The general consensus is no. That Answers post explains why this is generally discouraged and offers several alternative approaches.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!