Eliminate symbols from char to number

1 回表示 (過去 30 日間)
NG
NG 2014 年 8 月 14 日
回答済み: Andrei Bobrov 2014 年 8 月 14 日
How to convert 01-01-01 to 010101? And 01:01:01 to 010101?

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 8 月 14 日
out0 = regexp('01-01-01','\d*','match');
out = [out0{:}];

その他の回答 (1 件)

Pratik Bajaria
Pratik Bajaria 2014 年 8 月 14 日
編集済み: Pratik Bajaria 2014 年 8 月 14 日
Here's a workaround for this.
hypind=find(p=='-');
cnt=0;
cntp=1;
for i=1:size(p,2)
if i==hypind(cntp)
if cntp<size(hypind,2)
cntp=cntp+1;
end
else
cnt=cnt+1;
pfinal(cnt)=p(i);
end
end
Similarly, you can do for ' : '. Hope this helps.
Please let me know incase of further doubts.
Regards, Pratik

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by