Have equation, need to loop through all data and variables.
1 view (last 30 days)
Show older comments
I have an equation of answer# = (a+b)*c where a, b, and c, are each a column in a different data structure. How would I go about looping through this 100 times and saving/naming the answer something different for plotting?
2 Comments
John D'Errico
on 4 Aug 2020
Why do you think you need a loop? Maybe it is time to learn to use MATLAB?
d = (a+b).*c);
Answers (1)
Raunak Gupta
on 8 Aug 2020
Edited: Raunak Gupta
on 8 Aug 2020
Hi,
As John mentioned in the comments you can use element wise multiplication for above equation format. The data structure in which the data is stored can either be in struct format or in vector format (If it's in any other format you can access the individual value appropriately). Finally, you may bring down each variable a,b,c in vector format and can apply what John has suggested.
If the data is stored in different file format you can use this link to figure out how to import the data.
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements 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!