Hi all,
I would like to change all variable names within a table, to attached file, a cell array.
This is what i use now;
rf1.Properties.VariableNames = vars1

 채택된 답변

Stephen23
Stephen23 2018년 11월 22일
편집: Stephen23 2018년 11월 22일

3 개 추천

You can use a cell array of names, like this:
rfi.Properties.VariableNames = {'name1','name2',...}

댓글 수: 5

Jesse
Jesse 2018년 11월 22일
In this way i have to set the names manually. The names i want to assign are from another table...
What is the problem?
rfi.Properties.VariableNames = yourothertable.Properties.VariableNames
as long as both tables have the same number of variables obviously. If not, you'd have to add/remove elements to the cell array returned by yourothertable.Properties.VariableNames.
Stephen23
Stephen23 2018년 11월 22일
"In this way i have to set the names manually"
Nope. The names must be in a cell array or a string array, and while you could define that array manually, it is certainly not required. Why not just get the names of the other table using this:
C = othertable.Properties.VariableNames
rfi.Properties.VariableNames = C
Sampath Rachumallu
Sampath Rachumallu 2020년 6월 29일
Unable to add spaces in Column names of a table using above.
Steven Lord
Steven Lord 2020년 6월 29일
The ability to have spaces in table variable names was introduced in release R2019b as stated in the Release Notes.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2018년 11월 22일

댓글:

2023년 7월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by