How do I create cell/struct array with the specific lines taken from a text file?
古いコメントを表示
this is the code that i currently working with:
% open the file
fid = fopen('images_list1.txt');
% initialize a lineNumer
lineNum = 0;
% keep reading the file
while 1;
% get a line of text
tline = fgetl(fid); lineNum = lineNum + 1;
% exit if the line is empty
if tline == -1;
break;
end
% check modulus of lineNum for every 2nd and 11th line
if rem(lineNum,13) == 2;
tline_2nd = tline;
%disp(tline);
elseif rem(lineNum,13) == 11;
tline_11th = tline;
%disp(tline);
end
end
May I know how do I create cell/struct arrays with the every two lines I have extracted from my text file. For the first line, I'm extracting the image name with a format of "12345678.jpg" and for the second line, i'm extracting the no. of likes, which i would want it to be in a matrix if it is possible. Much help needed.. thanks!
2 件のコメント
Stephen23
2015 年 10 月 28 日
Can you upload the data file please. It is useful for us to try code on. You can upload a file by clicking the paperclip button and then both the Choose file and Attach file buttons.
Josephine Ng
2015 年 10 月 28 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!