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

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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Honglei Chen
Honglei Chen 2012년 4월 6일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

질문:

2012년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by