How to read an input text file having multiple values??
Mostrar comentarios más antiguos
0 0 0 0.5 0 0.049406182 1 0 0.097122055 0 0.51 0 0.5 0.51 0.049406182 1 0.51 0.097122055
1.5 0 0.143149239 2 0 0.187489294 1.5 0.51 0.143149239 2 0.51 0.187489294
Read these values of x1,y1,z1 x2,y2,z2 x3,y3,z3....and so on
Respuestas (2)
KSSV
el 10 de Oct. de 2018
0 votos
REead about load, importdata, textscan. If your file has only numbers then load / importdata should work.
Virajan Verma
el 10 de Oct. de 2018
0 votos
15 comentarios
KSSV
el 10 de Oct. de 2018
fid = fopen('inputxyzz.txt','r');
S = textscan(fid,'%f %f %f') ;
x = S{1} ; y = S{2} ; z = S{3} ;
fclose(fid) ;
scatter3(x,y,z,10,z,'filled')
Virajan Verma
el 10 de Oct. de 2018
KSSV
el 10 de Oct. de 2018
Friend......it is loading in the way what you want only...
coor = [x y z] ;
coor(1,:) % this igves you (x1,y1,z1)
coor(7,:) % this gives you (x7,y7,z7)
coor(i,:) % this gives you (xi,yi,zi) ;
Virajan Verma
el 10 de Oct. de 2018
KSSV
el 10 de Oct. de 2018
yes.....
Virajan Verma
el 10 de Oct. de 2018
KSSV
el 10 de Oct. de 2018
:(
I mean to say i = 1,2,....n
Virajan Verma
el 10 de Oct. de 2018
Editada: KSSV
el 10 de Oct. de 2018
madhan ravi
el 10 de Oct. de 2018
fid = fopen('inputxyzz.txt'','r');
S = textscan(fid,'%f %f %f') ;
x = S{1} ; y = S{2} ; z = S{3} ;
fclose(fid) ; scatter3(x,y,z,10,z,'filled')
coor = [x y z] ;
for i=1:1:122
coor(i,:)
end
Virajan Verma
el 10 de Oct. de 2018
KSSV
el 10 de Oct. de 2018
@ Virajan Verma dont blindly follow the code........read what the function does....the doubts you are asking are very silly.
fid = fopen('inputxyzz.txt','r');
S = textscan(fid,'%f %f %f') ;
x = S{1} ; y = S{2} ; z = S{3} ;
fclose(fid) ;
scatter3(x,y,z,10,z,'filled')
coor = [x y z] ;
for i = 1:length(X)
coor(i,:)
end
Virajan Verma
el 10 de Oct. de 2018
KSSV
el 10 de Oct. de 2018
No one done coding earlier, at the time of their career beginning .....one has to learn.....you are showing a part of your code...you are not showing full code.
Lxn_dash=N1*x1+N2*x2+N3*x3;
Obviously the above lines show error. Where you have defined (x1,x2,x3)????They are not defined....they are in the coor or (x,y,z) ..you need to provide the indices of it. May be like this:
Lxn_dash=N1*x(1)+N2*x(2)+N3*x(3);
Here, you will be having nodal connectivity data, with this nodal connectivity daya you will be getting the vertices of every element.
Virajan Verma
el 11 de Oct. de 2018
KSSV
el 11 de Oct. de 2018
It depends on the number of elements and number of nodes in each element.
Thanks officially for accepting the answer.
Categorías
Más información sobre Hypothesis Tests en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!