How to change the variable name after each run

3 次查看(过去 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?

回答(1 个)

Steven Lord
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.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by