Remove Whitespace & Text From Cell

If I have a cell like
[0.078 ms]
How can I remove both the whitespace and 'ms' to yield the result
[0.078]
Thanks,

1 Commento

@Cesar Cabrera: please upload a sample data file by clicking the paperclip button.

Accedi per commentare.

Risposte (2)

Kunal Kandhari
Kunal Kandhari il 31 Gen 2023

0 voti

Hi,
You can make use of strrep: Find and replace substrings function

3 Commenti

Thanks Kunal, what if I have several thousand cells with the same isuse? All with varying amounts of spaces with the same string 'ms'?
Hi Cesar,
You you please explain it is several thousand cell array or array of cells?
So that I can help you with that..
Can you write a dummy variable here?
.txt file
|0.56 ms|
|0.86 ms|
|0.91 ms|
|0.25 ms|
T= readtable(example.txt)
I want to parse the data into a table from a .txt file like
0.56
0.86
0.91
0.25

Accedi per commentare.

Categorie

Prodotti

Release

R2021a

Richiesto:

il 31 Gen 2023

Commentato:

il 31 Gen 2023

Community Treasure Hunt

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

Start Hunting!

Translated by