I am getting a string input \"HH:MM:SS\", I change it using strtok into \"t1=HHM
ID: 3533311 • Letter: I
Question
I am getting a string input "HH:MM:SS", I change it using strtok into "t1=HHMMSS"
I want to be able to find how many seconds until the next minute "sec2m=60-t1(5,6)"
The problem is I cant get t1 to be an actual number instead of a matrix. Lets say if my input is "09:15:23", my t1 turns it into "091523", this should be a number
and yet when I run "t1+2" I dont get "091525" I get "34 50 59 51 55 52 53"
How in the world do I keep it in an actual number? str2num?? str2double? I am new so please explain clearly for a noob
Explanation / Answer
yes, str2num works. you do get the last 2 number by mod-ing by 100. if your variable was t1, then mod(t1, 100)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.