필터 지우기
필터 지우기

Remove Whitespace & Text From Cell

조회 수: 7 (최근 30일)
Cesar Cabrera
Cesar Cabrera 2023년 1월 31일
댓글: Stephen23 2023년 1월 31일
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
Stephen23
Stephen23 2023년 1월 31일
@Cesar Cabrera: please upload a sample data file by clicking the paperclip button.

댓글을 달려면 로그인하십시오.

답변 (2개)

Kunal Kandhari
Kunal Kandhari 2023년 1월 31일
Hi,
You can make use of strrep: Find and replace substrings function
  댓글 수: 3
Kunal Kandhari
Kunal Kandhari 2023년 1월 31일
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?
Cesar Cabrera
Cesar Cabrera 2023년 1월 31일
.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

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2023년 1월 31일
See https://www.mathworks.com/help/matlab/ref/matlab.io.text.delimitedtextimportoptions.setvaropts.html#d124e755396 for the import options to ignore particular prefixes or suffixes. You would detectImportOptions and setvaropts and then pass the resulting options to readtable

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by