Getting a specific row out of a table for two specific inputs in matlab
1 view (last 30 days)
Show older comments
Good day,
I have a variable of type "dataset" containing the following data in tabular form for a specific year
Year Month Day Temp_max Temp_min Temp_avg
2005 1 1 21 12.6 15.867
2005 2 3 22 11.1 15.292
2005 7 21 51.1 18.4 36.35
So On..................................................
The user will give the inputs of month and day and for those specific month and date I will get the value of T_max and T_min any idea how I can do that ? As I have over 350 rows containing such data ? will be highly obliged if you can help me with the coding of this.
I can access the data of individual columns from Year.Month & Year.Day commands
0 Comments
Accepted Answer
Walter Roberson
on 17 Aug 2015
right_tablerow = YourTable(:,2) == UserEnteredMonth & YourTable(:,3) == UserEnteredDay;
TableEntry = YourTable(right_tablerow,:);
now you can extract the desired values out of TableEntry
17 Comments
Walter Roberson
on 17 Aug 2015
Sorry I forgot that I had posted a correction,
TableEntries = v(v.Month == M & v.Day == D,:);
More Answers (0)
See Also
Categories
Find more on Axis Labels 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!