필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How do it store a particularText file into an array ?

조회 수: 1 (최근 30일)
sachin narain
sachin narain 2019년 4월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
I have a Text file (attached along with the question).You can see there are lot of lines at the moment (there can be more) .i want to convert this text file to an array so that the array contains the lines row by row .
I know 'textscan' works but what exactly should my input arguments be so that i get the required result .
Thank you in advance

답변 (1개)

Bob Thompson
Bob Thompson 2019년 4월 15일
I would suggest loading the file and then splitting.
string = readfile('TestLists.txt');
lines = regexp(string,'\n','split');
  댓글 수: 3
sachin narain
sachin narain 2019년 4월 16일
I want to convert these lines into row by row data so that i can work on them later as an array
Bob Thompson
Bob Thompson 2019년 4월 16일
readfile is a custom created function. If you would prefer not to use a file of the file exchange then feel free to utilize fileread, importfile, or textscan (use '%s' as the format).
Using the split option with regexp will produce a cell array where each element contains one line of the file.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by