How to add header to a table?

156 visualizaciones (últimos 30 días)
Bai chen
Bai chen el 17 de Feb. de 2019
Comentada: Star Strider el 4 de Mzo. de 2020
Hello,
How can I add header to my table below ?
I want to add header
header={'Call price','Standard error','Number of paths'}
to the table.
S0=30;
K=32;
r=0.03;
sigma=0.2;
T=1;
n=365;
%m=500; % number of simulations
j=1;
for i=500:500:10000
[call_price,standard_error,numberOfpaths]=Call_Simulation(S0,K,r,sigma,n,i,T);
Call_Price(j)=call_price;
Standard_Error(j)=standard_error;
NumberOfPaths(j)=numberOfpaths;
j=j+1;
end
header={'Call price','Standard error','Number of paths'};
T=table(Call_Price',Standard_Error',NumberOfPaths');
disp(T);
error_table.PNG

Respuesta aceptada

Star Strider
Star Strider el 17 de Feb. de 2019
Use the 'VariableNames' (link) name-value pair with your ‘header’ cell array.
  5 comentarios
Shannon Wagoner
Shannon Wagoner el 4 de Mzo. de 2020
@walter can you shhow an example of summary?
Star Strider
Star Strider el 4 de Mzo. de 2020

Iniciar sesión para comentar.

Más respuestas (1)

Denise Selegato
Denise Selegato el 24 de Sept. de 2019
Hi, I've been having a similar problem.
I want to put the following header on my table(T):
header = {'#DATA=RDC', 'PRIOR=GAUSS'}
However, if I try to use T.Properties.VariableNames, it gives me an error because I started my cell array with a "#". I need this # to be included in the header.
Is there a solution to my problem?
Thank you!
  3 comentarios
Denise Selegato
Denise Selegato el 25 de Sept. de 2019
It worked perfctly on MATLAB2019b, thank you for helping.
Star Strider
Star Strider el 25 de Sept. de 2019
My pleasure.

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by