Export table from Live Script (formatting problem)

조회 수: 4 (최근 30일)
Stu Pgmmr
Stu Pgmmr 2024년 11월 26일
댓글: Stu Pgmmr 2024년 12월 13일
I create multi-column tables in LiveScript but when I export to *.pdf or *.doc files only the first column seems to be exported (see Exported_file.jpg). Is there some formatting command I am missing?
LiveScript code:
  1. clear all
  2. close all
  3. clc
  4. T = table(rand(5,5))
  댓글 수: 1
Image Analyst
Image Analyst 2024년 11월 26일
편집: Image Analyst 2024년 11월 26일
Exactly what steps did you do to create the PDF output?

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

채택된 답변

Sandeep Mishra
Sandeep Mishra 2024년 11월 28일
Hi Stu,
I ran the provided code in MATLAB R2024b and encountered the similar issue while generating the pdf using Export to pdf’ button.
The table generated by the code has 5x1 dimension instead of 5x5 dimension and hence the pdf was not getting generated correctly.
You can refer to the following code snippet to generate a 5x5 table:
data = rand(5, 5);
T = table(data(:, 1), data(:, 2), data(:, 3), data(:, 4), data(:, 5), ...
'VariableNames', {'Column1', 'Column2', 'Column3', 'Column4', 'Column5'})
For more information, refer to the following MathWorks Documentation to learn about ‘table function: https://www.mathworks.com/help/releases/R2024b/matlab/ref/table.html#btw1wrc-3
  댓글 수: 2
Peter Perkins
Peter Perkins 2024년 12월 1일
As Sandeep hints at, you likely wanted array2table(rand(5,5)), not table(rand(5,5)).
Stu Pgmmr
Stu Pgmmr 2024년 12월 13일
Thank you! array2table works well

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by