필터 지우기
필터 지우기

How can i read certain columns from txt file and save them for later usage?

조회 수: 1 (최근 30일)
Niya Bedzheva
Niya Bedzheva 2019년 8월 9일
댓글: Duane Melvin 2022년 12월 2일
hello, i would like to ask for some help, because i am in the beginning of learning matlab. So i have a txt file with 11 columns but i only need 3 of them without the headers (1,3 and 4). How can i make it read only them and save them in an array for using them later in the script.
i will upload the file and would appreciate any suggestions! Thank you

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 8월 9일
편집: KALYAN ACHARJYA 2019년 8월 9일
data_file=load('Aerosil_C10_T40_001.txt');
j=[1,3,4]; %define column number
colm_dada=data_file(:,j); % Column data for further use
Save colm_data
writetable(colm_data, 'file_name1.txt');
Now you can acess the file_name1.txt file in future work
  댓글 수: 3
Duane Melvin
Duane Melvin 2022년 12월 2일
Thanks so much for this answer as it was exactly what I needed!

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

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by