Results in table format in Matlab

0

When simulating a program in Matlab, is it possible to display the results in a table format?

Output of the program:

Nível de tensão (V): 200.6000 199.5000 231.1000 198.8000 200.6000 200.4000 
Data e hora: 21-Aug-2014 18:06:00 23-Aug-2014 18:06:00 24-Aug-2014 06:06:00 27-Aug-2014 08:36:00 29-Aug-2014 14:21:00 30-Aug-2014 07:36:00 

Desired format:

Data e hora                 Tensão
20-Aug-2014 09:15:00         225
20-Aug-2014 09:30:00         222
    
asked by anonymous 29.10.2014 / 22:25

2 answers

1

You can use the table command to not only tabulate the data but also tabulate it.

Ex:

T = table (['M', 'F', 'M'], [45; 32; 34], ...     {'NY', 'CA', 'MA'}, logical ([1; 0; 0]), ...     'VariableNames', {'Gender' 'Age' 'State' 'Vote'})

T =

Gender    Age    State    Vote 
______    ___    _____    _____

M         45     'NY'     true 
F         32     'CA'     false
M         34     'MA'     false

More details can be found in the table command help.

    
30.10.2014 / 13:14
1

Live.

See the following example.

resultados = {'Data e hora','Tensão'};
resultados{2,1} = '20-Aug-2014 09:15:00';
resultados{2,2} = '225';
resultados{3,1} = '20-Aug-2014 09:30:00';
resultados{3,2} = '222';
resultados

Then just use an index to automatically control the line where you will add new data, ie

resultados{i,1} = 'NOVA_DATA';
resultados{i,2} = 'NOVA_TENSAO';

I hope I have helped;)

PS (1):

Does this do what you want?

datas = ['1';'2';'3'];
tensao = [1,2,3];
resultados = {'Data e hora','Tensão'};
for i=1:size(datas,1)
      resultados{i+1,1} = datas(i);
      resultados{i+1,2} = tensao(i);
end
resultados
    
30.10.2014 / 11:04