reading data from dataset.txt

hello all, i have this file that contain the following
#NB_OF_USERS_PAIRS 1
1 2 2
#NB_OF_EDGE_PAIRS 2
2 2 3
3 2 3
i want to make a function that read from this file the number 1 after the #NB_OF_USERS_PARIS and read then the numbers 1 2 2 and so on, any help to begin writing this function please

답변 (2개)

Nirmal
Nirmal 2012년 7월 5일

0 개 추천

fid = fopen('data.txt');
M=textscan(fid,'%s');
fclose(fid);
X=M{1,1}
X will have each element including the header for users pairs and edge pairs.
ahmad
ahmad 2012년 7월 6일

0 개 추천

this is converting the text in to cell is there another way to convert it to string ??

카테고리

도움말 센터File Exchange에서 Text Analytics Toolbox에 대해 자세히 알아보기

질문:

2012년 7월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by