cell2mat functìon
how to extract the big content of a cell array?
2 次查看(过去 30 天)
显示 更早的评论
Hi! I have a 2859x1 cell array. In each cell there is a content like this:
1617026479572040798,,0,,0,0,'',25.0,,,[],0,"[76, 74, 71, 78, 76, 77, 73, 76, 73, 76, 79, 154, 158, 164, 166, 149, 134, 137, 131, 124, 123, 121, 114, 121, 117, 109, 120, 117, 115, 106, 104, 110, 111, 116, 116, 114, 109, 115, 114, 110, 106, 113, 109, 114, 114, 113, 118, 107, 110, 109,.....
I would like to save the numbers it into a double array. How could I do that? Thanks
11 个评论
Peter Perkins
2021-8-9
The problem is that once you type 1617026479572040798, you are already done for:
>> sprintf("%.20f",1617026479572040798)
ans =
"1617026479572040704.00000000000000000000"
If it's wrapped in uint64, things are OK,
>> uint64(1617026479572040798)
ans =
uint64
1617026479572040798
but then the question is how to get that into a datetime with as much precision as possible. The solution is epochtime:
>> datetime(uint64(1617026479572040798), 'convertfrom', 'epochtime','TicksPerSecond',1e9,'Epoch','1-Jan-1970','Format','dd-MMM-uuuu HH:mm:ss.SSSSSSSSS')
ans =
datetime
29-Mar-2021 14:01:19.572040798
Stephen23
2021-8-10
"Unfortunately I don't know how these data were stored. The file was given to me like this."
This contradicts your statement that "The whole file is too big to import so I selected just 3 cells."
Please upload an original file as requested. Do not upload data that you have already imported into MATLAB.
If the original file is too large to upload onto the forum, please shorten it whilst keeping its format representative.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!