Create and save a table
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vittorio Faustinella
el 17 de Nov. de 2021
Respondida: Cris LaPierre
el 17 de Nov. de 2021
How can i create and save a table from a multiple result of a function?
I used this command to print result on a file.dat
fprintf(fid1,' _______________________________________________________________________ \n');
fprintf(fid1,'r(m) b(r,t)(m) P(r,t)(Pa) r^2/t (m^2/s) Sw\n');
fprintf(fid1,' ________________________________________________________________ \n');
fprintf(fid1,'%15.2f %15.6f %15.6e %15.6e %12.4f\n',r,b_r,P,Sim,S_w)
and I've something like this
________________________________________________________________________
r(m) b(r,t)(m) P(r,t)(Pa) r^2/t (m^2/s) Sw
________________________________________________________________________
0.30 70.000000 2.068816e+07 2.853881e-09 0.3000
0.60 70.000000 2.060942e+07 1.141553e-08 0.3000
0.90 70.000000 2.056336e+07 2.568493e-08 0.3000
.... ........ ........ ........ ......
but i want the same result on a table .xls (for example) or .mat
Thanks for your help.
0 comentarios
Respuesta aceptada
Cris LaPierre
el 17 de Nov. de 2021
Since you already have the variables defined, I would create a variable of data type table.
varnames = ["r(m)" "b(r,t)(m)" "P(r,t)(Pa)" "r^2/t (m^2/s)" "Sw"];
r = [0.3 0.6 0.9]';
b_r = [70 70 70]';
P = [2.068816e7 2.060942e7 2.056336e7]';
Sim = [2.853881e-9 1.141553e-8 2.568493e-8]';
S_w = [.3 .3 .3]';
% create a table
T = table(r,b_r,P,Sim,S_w,'VariableNames',varnames)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!