Taking new value for a variable from excel at each step of Iteration
Show older comments
I am writing a program where conductor temperature is measured at different time of the day. Now i have to perform iterations and there are a set of input variables which I want to give at each step of iteration directly from the excel file. Like if the initial temperature is 50 at 8 am and then after putting other input variables like wind speed, solar intensity in heat transmission equations it comes to be 52 then at 8:30 pm this new temperature as well as a new set of data for input variables will be taken from the excel file. How to do this? Please explain
Answers (1)
Bob Thompson
on 2 Feb 2018
0 votes
I don't know if you're still looking for an answer for this problem or not, but I figured I could try to help anyway. How this is conducted largely depends on how your data is stored.
If you have a single excel file which has multiple sets of data then you can read the excel file and examine different pieces of the excel file with a for loop.
If you have a set of excel files with a single set of inputs each then you want to read the excel file within your iteration for loop.
If you have a single excel file which automatically overwrites the inputs each time then you're going to want to do the same reading with a for loop, but set it up to read in real time.
No matter how your data is set up you're probably going to want to use the xlsread() command, as this will read in the data from the excel file and then close the file again. Additionally, I'm assuming you have a for loop for each iteration, so all you really need to do is make sure you are drawing new inputs each time you go through the iteration loop.
If you're still looking for an answer and you have questions about what I responded with, feel free to let me know.
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!