Table.Prop​erties.Var​iableNames will add ... to long Variable Names

조회 수: 8 (최근 30일)
I want to read out the Variable names of a table i imported from excel with readtable.
Table.Properties.VariableNames will add 3 dots "..." to long Variable Names, thereby shortening the actual name in the cell array, and making them useless to index into said table column.
This might have to do with the way Tables are displayed when viewing them in the workspace.
Gave something along the lines of:
1×13 cell array
Columns 1 through 10
{'components_pos_'} {'name'} {'thickness__s__i…'} {'thermal_conduc_…'} {'heat_capac_c_in…'} {'density_in_kg_m_'} {'V_ignoreThisOne'} {'solar_absorp'} {'ir_emissivity'} {'g_value'}
Columns 11 through 13
{'shading_g_total'} {'shading_max_irr'} {'a_conv'}
Now for me personally i just need to fix this once or twice and thats no Problem, but it feels unintended. Is it a Bug?
There is also Table.Properties.VariableDESCRIPTIONs which puts out the same cell Array, now for Description it makes sense that it might put in the dots ...

채택된 답변

Steven Lord
Steven Lord 2025년 2월 28일
Is that an artifact of how the cell array is displayed in the Workspace (which I suspect is the case) or how the data is stored in the cell array?
name = repmat('a':'z', 1, 2);
t = table(1, 2, VariableNames = {[name, '1'], [name , '2']})
t = 1x2 table
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz2 _____________________________________________________ _____________________________________________________ 1 2
N = t.Properties.VariableNames
N = 1x2 cell array
{'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1'} {'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz2'}
nameOfVariable1 = N{1}
nameOfVariable1 = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1'
If it is just an artifact of the display, I don't consider that to be a bug.
  댓글 수: 1
Alexander Szambor
Alexander Szambor 2025년 3월 1일
It is an Artifact of how the cell array is displayed in the workspace, it results in three dots being displayed in the command window when not suppressing the output.
You are correct, if i pull out a certain cell value from the array the char is displayed correctly.

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

추가 답변 (1개)

Fangjun Jiang
Fangjun Jiang 2025년 2월 28일
편집: Fangjun Jiang 2025년 2월 28일
I think the OP was referring to the three dots in the image in the header row.
It is a display, @Alexander Szambor. If you drag and increase the width of the column in the matrix grid in the workspace view, the full variable name will be shown.
  댓글 수: 1
Alexander Szambor
Alexander Szambor 2025년 3월 1일
No, i was referring to the values in the cell array. Thank you anyways.

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by