MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   将字符串数组转换为单元格 (https://www.labfans.com/bbs/showthread.php?t=24279)

poster 2019-12-10 20:48

将字符串数组转换为单元格
 
我需要将单元格输出到Excel文件。在此之前,我需要将整数的日期列转换为日期字符串。我知道如何执行此操作,但是我无法将此新的字符串数组放回单元格中-

mycell = { 'AIR' [780] [1] [734472] [0.01] ; ... 'ABC' [780] [1] [734472] [0.02]} 我做到了->

dates = datestr(cell2mat(mycell(:,4))) ; 我需要的答案是:

{'AIR' [780] [1] '14-Dec-2010' [0.01] ; 'ABC' [780] [1] '23-Dec-2010' [0.03] ; } 这样我现在可以使用xlswrite.m将其发送到excel文件



[B]回答:[/B]

mycell = { 'AIR' 780 1 734472 0.01] ; ... 'ABC' 780 1 734472 0.02]} mycell(:,4) = cellstr(datestr(cell2mat(mycell(:,4)))) mycell = 'AIR' [780] [1] '30-Nov-2010' [0.01] 'ABC' [780] [1] '30-Nov-2010' [0.02]

[url=https://stackoverflow.com/questions/4564171]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:04

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.