Taking input from large excel data stored in multiple sheets based on different variables.

1 view (last 30 days)
I have a big excel data for temperature of different location based on variables month, wind speed, humidity etc.
  • we have measure temperature in every month at least once. Total 12 values.
  • humidity values varies from 30% to 70%
  • wind speed also changes from 0 m/s to 30 m/s Since data are based on different variables so I have stored data in different sheets.
Based on variable value i named each sheet in a specific way. Ex. 1. V_10_50 (formate month_windspeed_humidity) This sheet name specifies that month is a variable and temperature measured when in each month wind speed is 10m/s and humidity is 50% 2. Jan_V_50 This name specified that in January month when humidity is 50% we measure temperature at different wind speed.
In am similar way i have store data in excel. Can you suggest me a better way access these data from excel in order to interpolate temperature value for every possible combination of month, wind speed and humidity.

Answers (1)

Dave B
Dave B on 10 Oct 2021
If you look at the documentation for readtable you'll see that you can read a sepcific sheet name from an excel spreadsheet.
To put together a string that you'll pass to this function, there are lot's of options, and it probably depends a little bit on how your data is stored in matlab. For instance:
a='Jan';
b=10;
c=50;
join([string(a) string(b) string(c)],'_')
ans = "Jan_10_50"
sprintf('%s_%d_%d', a, b, c)
ans = 'Jan_10_50'
If your question is more about how to rethink your excel organization - you can import a lot of data pretty quickly. So is it maybe more convenient to keep month, wind speed, humudity as columns of one big sheet and just import it all at once to MATLAB? I generally think it's more easy to get subsets and move data around in MATLAB than excel, because you can automate it so easily with code, so if I can get all my data there early it's easier than multiple rounds of importing. But that may be because I have lots of experience. Either way, if you can separate out file IO from data processing that seems good!

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!