Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Matlab matrix
Replies: 2   Last Post: Feb 1, 2013 5:53 PM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: Matlab matrix
Posted: Feb 1, 2013 5:53 PM
 Plain Text Reply

On 2/1/2013 3:46 PM, James Tursa wrote:
> "M" wrote in message <kehbrk\$3pp\$1@newscl01ah.mathworks.com>...
>> How I can put time value like 10:23:34 in a matrix cell. Like below:
>> a(1,2)= 10:23:34

>
> One approach is to use a cell array and have the entry be a string. E.g.,
>
> a = cell(1,2);
> a{1,2} = '10:23:34';
>

And another is to use the fractional portion of a datenum representation--

>> a{1,2}=datenum('10:23:34',upper('hh:mm:ss'))-
fix(datenum('10:23:34',upper('hh:mm:ss')))
a =
[] [0.4330]
>> datestr(a{1,2},'HH:MM:SS')
ans =
10:23:34
>>

--

Date Subject Author
2/1/13 James Tursa
2/1/13 dpb

© The Math Forum at NCTM 1994-2018. All Rights Reserved.