How to read .bnn.lis file (ascii file) for the specific data
17 ビュー (過去 30 日間)
古いコメントを表示
Dear Experts,
I want to read the values inside orange line as an array.
file name is " SCINTILLAORS STACK WITH CHAMBER-1_21.bnn.lis " which looks like in the image (file is attached which I can open in with .txt format as i couldn't attach the original .bnn.lis file).
I tried the following method but it is not giving the desired terms
filename='SCINTILLAORS STACK WITH CHAMBER-1_21.bnn.lis';
fileid=fopen(filename);
c=textscan(fileid,'%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f');
fclose(fileid);
whos c
Please, help me take out the values inside the orange line
Thank you
0 件のコメント
採用された回答
Mathieu NOE
2022 年 8 月 26 日
hello
this is one possibility :
lines = readlines('SCINTILLAORS STACK WITH CHAMBER-1_21.txt');
%% main code
nn = find(contains(lines,'accurate deposition along the tracks requested')); % find the line number of this text
lines_to_read = 2; % read the 2 lines after line containing above text
for ck = 1:lines_to_read
tmp = (str2double(split(lines(nn+ck))))';
tmp(isnan(tmp)) = []; % remove NaNs
out{ck,1} = tmp; % store in cell array
end
% export to txt
writecell(out,'output.txt',"Delimiter","\t");
5 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!