need anyone's helps

5 views (last 30 days)
cute doll
cute doll on 6 Mar 2014
Edited: Walter Roberson on 6 Mar 2014
The built-in function clock returns a vector that contains six elements: the first three are the current date (year, month, day) and the last three represent the current time in hours, minutes, and seconds. The seconds is a real number, but all others are integers. Store the result from clock in a variable called myc. Then, store the first three elements from this variable in a variable called today, and the last three elements in a variable called now. Use the fix function on the vector variable called now to get just the integer part of the current time.
  1 Comment
Roger Stafford
Roger Stafford on 6 Mar 2014
What is there about this problem that is giving you difficulty? We need to see some effort on your part toward solving it. For example, how would you go about using the 'fix' function? Out of the six elements in 'clock' how would you extract the first three to place them somewhere else?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 6 Mar 2014
Hint: To assign elements 4 through 500 to a new variable:
newVariable = oldVariable(4:500);
That's really all the hints you need. I don't recommend the homework problem's instruction of overwriting the built-in function "now" by creating a new variable of that name. It's never advised to overwrite built in functions with your own variable names.

Tags

Community Treasure Hunt

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

Start Hunting!