我有一个数组A,其中包含hhmmss格式的时间信息。 最后,我想通过指示经过的时间(以秒为单位,从第一次开始)来规范化此数组。
A = [150213 150013 145813 145613 145413 145313 145213 145113 145013 144943 144913 144843 144833 144823 144813 144803 144753 144743 144741 144739 144737 144735 144733 144731 144729 144727 144725 144723 144721 144719]
所以,最后数组应该是:
A_updated = [894 774 654 534 414 354 294 234 174 144 114 84 74 64 54 44 34 24 22 20 18 16 14 12 10 8 6 4 2 0]
什么是最快的'Matlab方式'继续这个? 非常感谢你的想法。
I have an array A with time information in the format hhmmss. Ultimately, I would like to normalize this array by indicating the elapsed time (in seconds, starting from the first time).
A = [ 150213 150013 145813 145613 145413 145313 145213 145113 145013 144943 144913 144843 144833 144823 144813 144803 144753 144743 144741 144739 144737 144735 144733 144731 144729 144727 144725 144723 144721 144719]
So, in the end the array should be :
A_updated = [894 774 654 534 414 354 294 234 174 144 114 84 74 64 54 44 34 24 22 20 18 16 14 12 10 8 6 4 2 0 ]
What would be the quickest 'Matlab way' to proceed with this? Many thanks in advance for your ideas.
最满意答案
我暂时没有使用过Matlab,所以原谅语法错误,我现在还没有它,但是这就是我想要的。 基本上,将所有内容转换为秒,然后减去最后一个元素。
At = uint32(A); A_updated = mod(At,100); At = floor(At ./ 100); A_updated = A_updated + mod(At,100) * 60; At = floor(At ./ 100); A_updated = A_updated + At * 3600; A_updated = A_updated - A_updated(end);I haven't used Matlab in a while, so forgive the syntax mistakes, and I don't have it available right now, but here's what I would try. Basically, convert everything to seconds then subtract the last element.
At = uint32(A); A_updated = mod(At,100); At = floor(At ./ 100); A_updated = A_updated + mod(At,100) * 60; At = floor(At ./ 100); A_updated = A_updated + At * 3600; A_updated = A_updated - A_updated(end);更多推荐
发布评论