Read text file and store in .mat file

I have a text file with these values:
d030bcb1
6142d6ad
619b8312
618803cb
61866781
619c04c5
61c420b2
61ba1feb
61bec5b3
6221fe09
I want to read this text file and store in a .mat file.
thanks in advance

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 7일
편집: Azzi Abdelmalek 2013년 9월 7일

1 개 추천

fid = fopen('file1.txt');
A= textscan(fid,'%s');
fclose(fid);
celldisp(A)
save file2 A

추가 답변 (2개)

Walter Roberson
Walter Roberson 2013년 9월 7일

1 개 추천

data = regexp( fileread('file1.txt'), '\n', 'split' );
save file2 data
Razvan
Razvan 2013년 9월 7일

0 개 추천

filename = 'example.txt';
fileID = fopen(filename,'r');
data = textscan(fileID, '%s\n');
data = data{1};
fclose(fileID);
save('example.mat', 'data')

댓글 수: 1

Sudharsan
Sudharsan 2013년 9월 7일
Thanks Razvan
but this code writes only the first data i.e: d030bcb1 to the mat file.
can u help me further..

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

카테고리

태그

Community Treasure Hunt

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

Start Hunting!

Translated by