필터 지우기
필터 지우기

Printing a LaTeX Table with Some Number and some Words

조회 수: 2 (최근 30일)
Michael
Michael 2013년 10월 22일
댓글: Kelly Kearney 2013년 10월 23일
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!

채택된 답변

Kelly Kearney
Kelly Kearney 2013년 10월 22일
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
Michael
Michael 2013년 10월 22일
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 2013년 10월 23일
Same basic idea:
data = [sDetNamesGe' num2cell(TFWL_pos_det)]';
sprintf('%s & %.2f & %.2f & %.2f \\\\\n', data{:})

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by