I have the following text file:
Eu3+ 1 10.06037350 -4.673610300 -1.834337367 1.22604929765 -2.02696902730 0.734136756877 10517.3113705 -9795.46057045 -2441.96899290 Eu3+ 2 -11.25268764 3.982158778 -4.411302032 0.239696547775E-01 0.719865908056 0.654664578760 -3423.27694546 -2308.86356341 -348.027397200
Whereby the entries are to be considered as (1) atom type (2) atom number (3)(4)(5) xyz coordinates (6)(7)(8)(9)(10)(11) irrelevant, and then repeated. I want to be able to represent a huge list of such data entries as atom positions and ultimately perform further calculations upon them, but currently I am only able to plot a single atom, using this code:
fid = fopen('twoatom.txt','r'); %read as a single cell
A = textscan(fid,'%s'); %perform textscan
A = A{1,1}(1:5); %Attain data as 1x5 cell array
a1 = A(1,:); %Atom type to vector
a2=str2double(A(2:end,:)); %Atom coordinates to vector
scatter3(a2(2),a2(3),a2(4))
But I have already had to ask for quite a bit of help to get this far, and am struggling to extend the code to accommodate a second atom. Could anyone enlighten me as to how this would be done? I am hoping that if someone can I will be able to extend the code myself to accommodate every atom in the file.
Any help would be greatly appreciated.
Kind regards,
Tom
Best Answer