How to delete the colon's in a matrix?

1 Ansicht (letzte 30 Tage)
bilgesu ak
bilgesu ak am 9 Mär. 2016
Kommentiert: bilgesu ak am 9 Mär. 2016
Hi;
I have a data in the form of :
1,2:8
1,3:3
1,4:3
1,5:2
1,6:5
Is there an easy way to remove the colons and have the form below?
1,2,8
1,3,3
1,4,3
1,5,2
1,6,5
I have many many rows like that and I am looking for a quick way if possible...
Regards...
  2 Kommentare
Stephen23
Stephen23 am 9 Mär. 2016
Bearbeitet: Stephen23 am 9 Mär. 2016
Why not just find-and-replace using any text editor?
bilgesu ak
bilgesu ak am 9 Mär. 2016
Thanks very much. Sometimes I try to solve everything in Matlab... I correct it in a Word file and paste to the m.file...
Thank you very much!!
Regards...

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Walter Roberson
Walter Roberson am 9 Mär. 2016
If you have strings or a cell array of strings, you could use
regexp(TheData, ':', ',')
  1 Kommentar
bilgesu ak
bilgesu ak am 9 Mär. 2016
I have the data only. when I paste it to th m.file it is shown as I wrote before.. How can I convert it to strings? I want to have a matrix at the end like:
[1,2,8
1,3,3
1,4,3
....]

Melden Sie sich an, um zu kommentieren.


Jos (10584)
Jos (10584) am 9 Mär. 2016
Is the data stored as strings in a cell array?
C = {'1,6:3','2,5:3','99,103:4'}
C2 = strrep(C,':',',')

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by