Filter löschen
Filter löschen

Printing a LaTeX Table with Some Number and some Words

4 Ansichten (letzte 30 Tage)
Michael
Michael am 22 Okt. 2013
Kommentiert: Kelly Kearney am 23 Okt. 2013
I have a string:
sDetNamesGe = {'T1Z2', 'T1Z5', 'T2Z3','T2Z5', 'T3Z2','T3Z4',...
'T3Z5','T3Z6', 'T4Z2', 'T4Z4', 'T4Z5','T4Z6', 'T5Z4', 'T5Z5'};
and I have a matrix and I know how to concatenate them...but I want the results to print in a LaTeX table something like:
T1Z2 & matelem11 & ... \\
T1Z5 & matelem12 & ...\\
I think you get the picture. IS there a quick way to force string to print when using latex()? What might you do to print letters and numbers in a tex'd up table such as the one above?
Thanks for your time!

Akzeptierte Antwort

Kelly Kearney
Kelly Kearney am 22 Okt. 2013
You mean like this?
sDetNamesGe = {'T1Z2', 'T1Z5', 'T2Z3','T2Z5', 'T3Z2','T3Z4',...
'T3Z5','T3Z6', 'T4Z2', 'T4Z4', 'T4Z5','T4Z6', 'T5Z4', 'T5Z5'};
data = [sDetNamesGe; num2cell(1:length(sDetNamesGe))];
sprintf('%s & matelem%d \\\\\n', data{:})
  2 Kommentare
Michael
Michael am 22 Okt. 2013
What if the matelem have more than one row? In a matrix called TFWL_pos_det like:
0.77 0.96 0.84
0.80 0.34 0.25
0.19 0.59 0.81
0.49 0.22 0.24
0.45 0.75 0.93
0.65 0.26 0.35
0.71 0.51 0.20
0.75 0.70 0.25
0.28 0.89 0.62
0.68 0.96 0.47
0.66 0.55 0.35
0.16 0.14 0.83
0.12 0.15 0.59
0.50 0.26 0.55
Kelly Kearney
Kelly Kearney am 23 Okt. 2013
Same basic idea:
data = [sDetNamesGe' num2cell(TFWL_pos_det)]';
sprintf('%s & %.2f & %.2f & %.2f \\\\\n', data{:})

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by