Create and save a table
33 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vittorio Faustinella
il 17 Nov 2021
Risposto: Cris LaPierre
il 17 Nov 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 Commenti
Risposta accettata
Cris LaPierre
il 17 Nov 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!