removing the text data by only keeping the numerical values

I want to remove all the text present before the two columns with numerical values.I have several files like this how can i do it for all the text files at the same time

답변 (2개)

Adam Danz
Adam Danz 2021년 4월 21일

0 개 추천

Use readtable or readmatrix. Both functions allow you to specify the starting line of the data.

댓글 수: 2

how will i do it if it is a text file
Those functions are designed to work with text files and other types of files.
Read the documentation, that's why I provided links. There's a bit of a learning curve to using these functions since they have many different options but that's all explained in the documentation along with examples. Walter Roberson's answer shows you how to do this and each of those steps are explained in the links I provided above.

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

filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/592115/D11.csv';
opt = detectImportOptions(filename, 'readvariablenames', false, 'headerlines', 9, 'extracolumnsrule', 'ignore');
t = readtable(filename, opt );
t.Properties.VariableNames = {'X-AXIS', 'Y-AXIS'};
summary(t)
Variables: X-AXIS: 2000×1 double Values: Min 0 Median 499.75 Max 999.5 Y-AXIS: 2000×1 double Values: Min -77 Median -0.5 Max 104

카테고리

도움말 센터File Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

질문:

2021년 4월 21일

댓글:

2021년 4월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by