Making function to calculate value when user inputs date

Hello! Im currently attempting to make a function that will have input arguments as "(month, day)" and return the value within a piece of excel data that corresponds with 7 days (columns) a week and 53 weeks (rows). I started with the following:
function [ ] = MonthDay( data (excel file),Month,Day )
%User Enters in day month and excel data and returns value within %that cell
Month=input('Please Enter the Month and indicate your input between two Apostrophes \n')
Day=input(' Please enter the Day of the Month and indicate input between two Apostrophes\n')
if (Month=='January');
I simply cannot figure out how to convert the date to the value within the cell and am basically stuck. Any help would be greatly appreciated. Thank you. -John

1 Comment

Please choose meaningful tags: all questions in the forum concern "matlab" or "matlab code".
Do not use == to compare strings, because it operates on the elements:
'a' = 'abca' % ==> [true, false, false, true]
'abca' = 'abca' % ==> [true, true, true, true]
Use strcmp instead.

Sign in to comment.

Answers (1)

I think you need more information. Given only month and date, how can you figure out the weekday information? Or is it for a given year?
The following link should be helpful

Categories

Products

Asked:

on 6 Apr 2012

Community Treasure Hunt

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

Start Hunting!