MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab:使用Unicode字符从字符串中除去字符 (https://www.labfans.com/bbs/showthread.php?t=26628)

poster 2019-12-14 20:13

Matlab:使用Unicode字符从字符串中除去字符
 
我有一个长字符串,看起来像:

銇濄伄浠?-9999.00銇濄伄浠?-9999.00銇濄伄浠?-9999.00銇濄伄浠?-9999.00 等等。我想在换行符处拆分,并删除所有内容,直到逗号为止,然后保持浮动。所以我的输出应该是这样的:

A = [-9999.99 -9999.99 -9999.99 -9999.99] 知道如何相对快速地执行此操作(最多几秒钟)吗?该字符串中有近一百万行。

谢谢!



[B]回答:[/B]

我认为最好的方法是使用textscan :

out = textscan(str, '%*s%f', 'delimiter', ','); out = out{1};

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


所有时间均为北京时间。现在的时间是 09:08

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