How can I set multiple variables to the same initial value efficiently?
117 views (last 30 days)
Show older comments
Commented: madhan ravi on 13 Dec 2018
I hate using the following way of defining variables;
a= 5, b=a, c=a, d=a, etc
I have a lot of variable taking the same intial value, how can do it efficiently?
Thanks in advance!
Stephen23 on 6 Dec 2018
"I have a lot of variable taking the same intial value, how can do it efficiently?"
Simple: store your data in one array.
Having "a lot of variables" is a sign that you should be using arrays anyway.
More Answers (1)
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!