MATLAB: Open bdf Nastran file in Matlab

MATLABmatlab;fopen;nastran;bdf

Hello, I want to Read attach file which is a bdf file in nastran in matlab and define assign for example specific CBEAM data in specific variable.
Please help me on this.
Best, haghnejat

Best Answer

fname = 'bpillar.bdf' ;
fid = fopen(fname,'r') ;
S = textscan(fid,'%s','Delimiter','\n');
fclose(fid) ;
S = S{1} ;
%%Get the line number of CBEAM
idxS = strfind(S, 'CBEAM');
idx = find(not(cellfun('isempty', idxS)));
cbeam = S(idx(2:end))